本文整理汇总了Java中com.netflix.loadbalancer.ServerListFilter类的典型用法代码示例。如果您正苦于以下问题:Java ServerListFilter类的具体用法?Java ServerListFilter怎么用?Java ServerListFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerListFilter类属于com.netflix.loadbalancer包,在下文中一共展示了ServerListFilter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testBuildWithDiscoveryEnabledNIWSServerList
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Test
public void testBuildWithDiscoveryEnabledNIWSServerList() {
IRule rule = new AvailabilityFilteringRule();
ServerList<DiscoveryEnabledServer> list = new DiscoveryEnabledNIWSServerList("dummy:7001");
ServerListFilter<DiscoveryEnabledServer> filter = new ZoneAffinityServerListFilter<DiscoveryEnabledServer>();
ZoneAwareLoadBalancer<DiscoveryEnabledServer> lb = LoadBalancerBuilder.<DiscoveryEnabledServer>newBuilder()
.withDynamicServerList(list)
.withRule(rule)
.withServerListFilter(filter)
.buildDynamicServerListLoadBalancer();
assertNotNull(lb);
assertEquals(Lists.newArrayList(expected), lb.getAllServers());
assertSame(filter, lb.getFilter());
assertSame(list, lb.getServerListImpl());
Server server = lb.chooseServer();
// make sure load balancer does not recreate the server instance
assertTrue(server instanceof DiscoveryEnabledServer);
}
开发者ID:Netflix,项目名称:ribbon,代码行数:19,代码来源:LBBuilderTest.java
示例2: testBuildWithDiscoveryEnabledNIWSServerListAndUpdater
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Test
public void testBuildWithDiscoveryEnabledNIWSServerListAndUpdater() {
IRule rule = new AvailabilityFilteringRule();
ServerList<DiscoveryEnabledServer> list = new DiscoveryEnabledNIWSServerList("dummy:7001");
ServerListFilter<DiscoveryEnabledServer> filter = new ZoneAffinityServerListFilter<DiscoveryEnabledServer>();
ServerListUpdater updater = new PollingServerListUpdater();
ZoneAwareLoadBalancer<DiscoveryEnabledServer> lb = LoadBalancerBuilder.<DiscoveryEnabledServer>newBuilder()
.withDynamicServerList(list)
.withRule(rule)
.withServerListFilter(filter)
.withServerListUpdater(updater)
.buildDynamicServerListLoadBalancerWithUpdater();
assertNotNull(lb);
assertEquals(Lists.newArrayList(expected), lb.getAllServers());
assertSame(filter, lb.getFilter());
assertSame(list, lb.getServerListImpl());
assertSame(updater, lb.getServerListUpdater());
Server server = lb.chooseServer();
// make sure load balancer does not recreate the server instance
assertTrue(server instanceof DiscoveryEnabledServer);
}
开发者ID:Netflix,项目名称:ribbon,代码行数:22,代码来源:LBBuilderTest.java
示例3: getAllServers
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Override
public List<Server> getAllServers() {
List<Server> servers = serverList;
for (ServerListFilter<Server> filter : filters.values()) {
servers = filter.getFilteredListOfServers(servers);
}
return servers;
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:9,代码来源:LoadBalancer.java
示例4: loadBalancer
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
/**
* The load balancer definition.
*
* @param config the client config.
* @param serverList the server list.
* @param serverListFilter the server list filter.
* @param rule the load balancing rule.
* @param ping the ping strategy.
* @param serverListUpdater the server list updater.
* @return The Dynamic Server List Load Balancer.
*/
@Bean
@ConditionalOnMissingBean
public ILoadBalancer loadBalancer(IClientConfig config,
ServerList<Server> serverList,
ServerListFilter<Server> serverListFilter,
IRule rule, IPing ping,
ServerListUpdater serverListUpdater) {
log.debug("dynamic server list load balancer enabled.");
return new DynamicServerListLoadBalancer<>(config, rule, ping, serverList,
serverListFilter, serverListUpdater);
}
开发者ID:enadim,项目名称:spring-cloud-ribbon-extensions,代码行数:23,代码来源:RuleBaseConfig.java
示例5: serverListFilter
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
/**
* The server list filter definition.
*
* @return a pass-through filter.
*/
@Bean
@ConditionalOnMissingBean
public ServerListFilter<Server> serverListFilter() {
log.debug("ribbon discovery server list filter disabled.");
return x -> x;
}
开发者ID:enadim,项目名称:spring-cloud-ribbon-extensions,代码行数:12,代码来源:RuleBaseConfig.java
示例6: ribbonServerListFilter
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ServerListFilter<Server> ribbonServerListFilter() {
MarathonServiceHealthCheckFilter filter = new MarathonServiceHealthCheckFilter();
filter.initWithNiwsConfig(clientConfig);
return filter;
}
开发者ID:aatarasoff,项目名称:spring-cloud-marathon,代码行数:8,代码来源:MarathonRibbonClientConfiguration.java
示例7: ribbonLoadBalancer
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ILoadBalancer ribbonLoadBalancer(IClientConfig config,
ServerList<Server> serverList, ServerListFilter<Server> serverListFilter,
IRule rule, IPing ping) {
ZoneAwareLoadBalancer<Server> balancer = LoadBalancerBuilder.newBuilder()
.withClientConfig(config).withRule(rule).withPing(ping)
.withServerListFilter(serverListFilter).withDynamicServerList(serverList)
.buildDynamicServerListLoadBalancer();
return new DemoLoadBalancer(balancer);
}
开发者ID:spencergibb,项目名称:ribbondemo,代码行数:12,代码来源:RibbonDemoRibbonConfig.java
示例8: PropertiesFactory
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
public PropertiesFactory() {
classToProperty.put(ILoadBalancer.class, "NFLoadBalancerClassName");
classToProperty.put(IPing.class, "NFLoadBalancerPingClassName");
classToProperty.put(IRule.class, "NFLoadBalancerRuleClassName");
classToProperty.put(ServerList.class, "NIWSServerListClassName");
classToProperty.put(ServerListFilter.class, "NIWSServerListFilterClassName");
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:8,代码来源:PropertiesFactory.java
示例9: ribbonLoadBalancer
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public ILoadBalancer ribbonLoadBalancer(IClientConfig config,
ServerList<Server> serverList, ServerListFilter<Server> serverListFilter,
IRule rule, IPing ping, ServerListUpdater serverListUpdater) {
if (this.propertiesFactory.isSet(ILoadBalancer.class, name)) {
return this.propertiesFactory.get(ILoadBalancer.class, config, name);
}
return new ZoneAwareLoadBalancer<>(config, rule, ping, serverList,
serverListFilter, serverListUpdater);
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:RibbonClientConfiguration.java
示例10: ribbonServerListFilter
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@SuppressWarnings("unchecked")
public ServerListFilter<Server> ribbonServerListFilter(IClientConfig config) {
if (this.propertiesFactory.isSet(ServerListFilter.class, name)) {
return this.propertiesFactory.get(ServerListFilter.class, config, name);
}
ZonePreferenceServerListFilter filter = new ZonePreferenceServerListFilter();
filter.initWithNiwsConfig(config);
return filter;
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:RibbonClientConfiguration.java
示例11: serverListFilterOverride
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Test
public void serverListFilterOverride() throws Exception {
ServerListFilter<Server> filter = getLoadBalancer("foo").getFilter();
assertEquals("FooTestZone",
ZonePreferenceServerListFilter.class.cast(filter)
.getZone());
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:8,代码来源:RibbonClientPreprocessorOverridesIntegrationTests.java
示例12: ribbonServerServerListFilter
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
public ServerListFilter<Server> ribbonServerServerListFilter() {
return new DemoServerListFilter();
}
开发者ID:spencergibb,项目名称:ribbondemo,代码行数:5,代码来源:RibbonDemoRibbonConfig.java
示例13: ribbonServerListFilter
import com.netflix.loadbalancer.ServerListFilter; //导入依赖的package包/类
@Bean
public ServerListFilter<Server> ribbonServerListFilter() {
return new HealthServiceServerListFilter();
}
开发者ID:spring-cloud,项目名称:spring-cloud-consul,代码行数:5,代码来源:ConsulRibbonClientConfiguration.java
注:本文中的com.netflix.loadbalancer.ServerListFilter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论