@Test public void testDynamicServerListLoadBalancer() throws Exception { DefaultClientConfigImpl config = DefaultClientConfigImpl.getClientConfigWithDefaultValues(); config.set(CommonClientConfigKey.NIWSServerListClassName, MyServerList.class.getName()); config.set(CommonClientConfigKey.NFLoadBalancerClassName, DynamicServerListLoadBalancer.class.getName()); config.set(CommonClientConfigKey.ServerListRefreshInterval, 50); DynamicServerListLoadBalancer<Server> lb = new DynamicServerListLoadBalancer<Server>(config); try { assertTrue(MyServerList.latch.await(2, TimeUnit.SECONDS)); } catch (InterruptedException e) { } assertEquals(lb.getAllServers(), MyServerList.list); lb.stopServerListRefreshing(); Thread.sleep(1000); int count = MyServerList.counter.get(); assertTrue(count >= 5); Thread.sleep(1000); assertEquals(count, MyServerList.counter.get()); }
public DynamicServerListLoadBalancer() { super(); }
DynamicServerListLoadBalancer extends BaseLoadBalancer { public DynamicServerListLoadBalancer() { super(); } }
DynamicServerListLoadBalancer extends BaseLoadBalancer { public DynamicServerListLoadBalancer() { super(); } DynamicServerListLoadBalancer(); @Deprecated  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, 
            ServerList<T> serverList, ServerListFilter<T> filter);  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping,
                                         ServerList<T> serverList, ServerListFilter<T> filter,
                                         ServerListUpdater serverListUpdater);  DynamicServerListLoadBalancer(IClientConfig clientConfig); }
DynamicServerListLoadBalancer extends BaseLoadBalancer { public DynamicServerListLoadBalancer() { super(); } DynamicServerListLoadBalancer(); @Deprecated  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, 
            ServerList<T> serverList, ServerListFilter<T> filter);  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping,
                                         ServerList<T> serverList, ServerListFilter<T> filter,
                                         ServerListUpdater serverListUpdater);  DynamicServerListLoadBalancer(IClientConfig clientConfig); @Override void initWithNiwsConfig(IClientConfig clientConfig); @Override void initWithNiwsConfig(IClientConfig clientConfig, Factory factory); @Override void setServersList(List lsrv); ServerList<T> getServerListImpl(); void setServerListImpl(ServerList<T> niwsServerList); ServerListFilter<T> getFilter(); void setFilter(ServerListFilter<T> filter); ServerListUpdater getServerListUpdater(); void setServerListUpdater(ServerListUpdater serverListUpdater); @Override /** * Makes no sense to ping an inmemory disc client * */ void forceQuickPing(); void enableAndInitLearnNewServersFeature(); void stopServerListRefreshing(); @VisibleForTesting void updateListOfServers(); @Override String toString(); @Override void shutdown(); @Monitor(name="LastUpdated", type=DataSourceType.INFORMATIONAL) String getLastUpdate(); @Monitor(name="DurationSinceLastUpdateMs", type= DataSourceType.GAUGE) long getDurationSinceLastUpdateMs(); @Monitor(name="NumUpdateCyclesMissed", type=DataSourceType.GAUGE) int getNumberMissedCycles(); @Monitor(name="NumThreads", type=DataSourceType.GAUGE) int getCoreThreads(); }
DynamicServerListLoadBalancer extends BaseLoadBalancer { public DynamicServerListLoadBalancer() { super(); } DynamicServerListLoadBalancer(); @Deprecated  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping, 
            ServerList<T> serverList, ServerListFilter<T> filter);  DynamicServerListLoadBalancer(IClientConfig clientConfig, IRule rule, IPing ping,
                                         ServerList<T> serverList, ServerListFilter<T> filter,
                                         ServerListUpdater serverListUpdater);  DynamicServerListLoadBalancer(IClientConfig clientConfig); @Override void initWithNiwsConfig(IClientConfig clientConfig); @Override void initWithNiwsConfig(IClientConfig clientConfig, Factory factory); @Override void setServersList(List lsrv); ServerList<T> getServerListImpl(); void setServerListImpl(ServerList<T> niwsServerList); ServerListFilter<T> getFilter(); void setFilter(ServerListFilter<T> filter); ServerListUpdater getServerListUpdater(); void setServerListUpdater(ServerListUpdater serverListUpdater); @Override /** * Makes no sense to ping an inmemory disc client * */ void forceQuickPing(); void enableAndInitLearnNewServersFeature(); void stopServerListRefreshing(); @VisibleForTesting void updateListOfServers(); @Override String toString(); @Override void shutdown(); @Monitor(name="LastUpdated", type=DataSourceType.INFORMATIONAL) String getLastUpdate(); @Monitor(name="DurationSinceLastUpdateMs", type= DataSourceType.GAUGE) long getDurationSinceLastUpdateMs(); @Monitor(name="NumUpdateCyclesMissed", type=DataSourceType.GAUGE) int getNumberMissedCycles(); @Monitor(name="NumThreads", type=DataSourceType.GAUGE) int getCoreThreads();  }