com.netflix.loadbalancer.ServerListFilter Java Examples
The following examples show how to use
com.netflix.loadbalancer.ServerListFilter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LBBuilderTest.java From ribbon with Apache License 2.0 | 6 votes |
@Test public void testBuildWithDiscoveryEnabledNIWSServerList() { IRule rule = new AvailabilityFilteringRule(); ServerList<DiscoveryEnabledServer> list = new DiscoveryEnabledNIWSServerList("dummy:7001"); ServerListFilter<DiscoveryEnabledServer> filter = new ZoneAffinityServerListFilter<>(); 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); }
Example #2
Source File: LBBuilderTest.java From ribbon with Apache License 2.0 | 6 votes |
@Test public void testBuildWithDiscoveryEnabledNIWSServerListAndUpdater() { IRule rule = new AvailabilityFilteringRule(); ServerList<DiscoveryEnabledServer> list = new DiscoveryEnabledNIWSServerList("dummy:7001"); ServerListFilter<DiscoveryEnabledServer> filter = new ZoneAffinityServerListFilter<>(); 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); }
Example #3
Source File: RuleBaseConfig.java From spring-cloud-ribbon-extensions with Apache License 2.0 | 5 votes |
/** * 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); }
Example #4
Source File: RuleBaseConfig.java From spring-cloud-ribbon-extensions with Apache License 2.0 | 5 votes |
/** * 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; }
Example #5
Source File: MarathonRibbonClientConfiguration.java From spring-cloud-marathon with MIT License | 5 votes |
@Bean @ConditionalOnMissingBean public ServerListFilter<Server> ribbonServerListFilter() { MarathonServiceHealthCheckFilter filter = new MarathonServiceHealthCheckFilter(); filter.initWithNiwsConfig(clientConfig); return filter; }
Example #6
Source File: CustomIloadBalancer.java From spring-cloud-formula with Apache License 2.0 | 4 votes |
public CustomIloadBalancer(IClientConfig config, IRule rule, IPing ping, ServerList serverList, ServerListFilter serverListFilter, ServerListUpdater serverListUpdater) { super(config, rule, ping, serverList, serverListFilter, serverListUpdater); }