com.netflix.loadbalancer
Class DynamicServerListLoadBalancer<T extends Server>

java.lang.Object
  extended by com.netflix.loadbalancer.AbstractLoadBalancer
      extended by com.netflix.loadbalancer.BaseLoadBalancer
          extended by com.netflix.loadbalancer.DynamicServerListLoadBalancer<T>
All Implemented Interfaces:
IClientConfigAware, PrimeConnections.PrimeConnectionListener, ILoadBalancer
Direct Known Subclasses:
ZoneAwareLoadBalancer

public class DynamicServerListLoadBalancer<T extends Server>
extends BaseLoadBalancer

A LoadBalancer that has the capabilities to obtain the candidate list of servers using a dynamic source. i.e. The list of servers can potentially be changed at Runtime. It also contains facilities wherein the list of servers can be passed through a Filter criteria to filter out servers that do not meet the desired criteria.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.netflix.loadbalancer.AbstractLoadBalancer
AbstractLoadBalancer.ServerGroup
 
Field Summary
protected  java.util.concurrent.atomic.AtomicBoolean serverListUpdateInProgress
           
 
Fields inherited from class com.netflix.loadbalancer.BaseLoadBalancer
allServerList, allServerLock, lbStats, lbTimer, maxTotalPingTimeSeconds, name, ping, pingInProgress, pingIntervalSeconds, rule, serverComparator, upServerList, upServerLock
 
Constructor Summary
DynamicServerListLoadBalancer()
           
DynamicServerListLoadBalancer(IClientConfig niwsClientConfig)
           
 
Method Summary
 void enableAndInitLearnNewServersFeature()
          Feature that lets us add new instances (from AMIs) to the list of existing servers that the LB will use Call this method if you want this feature enabled
 void forceQuickPing()
           
 ServerListFilter<T> getFilter()
           
 ServerList<T> getServerListImpl()
           
 void initWithNiwsConfig(IClientConfig clientConfig)
          Concrete implementation should implement this method so that the configuration set via IClientConfig (which in turn were set via Archaius properties) will be taken into consideration
 void setFilter(ServerListFilter<T> filter)
           
 void setPing(IPing ping)
           
 void setRule(IRule rule)
           
protected  void setServerListForZones(java.util.Map<java.lang.String,java.util.List<Server>> zoneServersMap)
           
 void setServerListImpl(ServerList<T> niwsServerList)
           
 void setServersList(java.util.List lsrv)
          Set the list of servers used as the server pool.
 void shutdownExecutorPool()
           
 java.lang.String toString()
           
protected  void updateAllServerList(java.util.List<T> ls)
          Update the AllServer list in the LoadBalancer if necessary and enabled
 
Methods inherited from class com.netflix.loadbalancer.BaseLoadBalancer
addServer, addServers, cancelPingTask, choose, chooseServer, getLoadBalancerStats, getMaxTotalPingTime, getName, getPing, getPingInterval, getPrimeConnections, getRule, getServerByIndex, getServerCount, getServerList, getServerList, init, isEnablePrimingConnections, isPingInProgress, lockAllServerList, lockUpServerList, markServerDown, markServerDown, primeCompleted, setEnablePrimingConnections, setLoadBalancerStats, setMaxTotalPingTime, setPingInterval, setPrimeConnections
 
Methods inherited from class com.netflix.loadbalancer.AbstractLoadBalancer
chooseServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverListUpdateInProgress

protected java.util.concurrent.atomic.AtomicBoolean serverListUpdateInProgress
Constructor Detail

DynamicServerListLoadBalancer

public DynamicServerListLoadBalancer()

DynamicServerListLoadBalancer

public DynamicServerListLoadBalancer(IClientConfig niwsClientConfig)
Method Detail

initWithNiwsConfig

public void initWithNiwsConfig(IClientConfig clientConfig)
Description copied from interface: IClientConfigAware
Concrete implementation should implement this method so that the configuration set via IClientConfig (which in turn were set via Archaius properties) will be taken into consideration

Specified by:
initWithNiwsConfig in interface IClientConfigAware
Overrides:
initWithNiwsConfig in class BaseLoadBalancer

setServersList

public void setServersList(java.util.List lsrv)
Description copied from class: BaseLoadBalancer
Set the list of servers used as the server pool. This overrides existing server list.

Overrides:
setServersList in class BaseLoadBalancer

setServerListForZones

protected void setServerListForZones(java.util.Map<java.lang.String,java.util.List<Server>> zoneServersMap)

getServerListImpl

public ServerList<T> getServerListImpl()

setServerListImpl

public void setServerListImpl(ServerList<T> niwsServerList)

setPing

public void setPing(IPing ping)
Overrides:
setPing in class BaseLoadBalancer

setRule

public void setRule(IRule rule)
Overrides:
setRule in class BaseLoadBalancer

getFilter

public ServerListFilter<T> getFilter()

setFilter

public void setFilter(ServerListFilter<T> filter)

forceQuickPing

public void forceQuickPing()
Overrides:
forceQuickPing in class BaseLoadBalancer

enableAndInitLearnNewServersFeature

public void enableAndInitLearnNewServersFeature()
Feature that lets us add new instances (from AMIs) to the list of existing servers that the LB will use Call this method if you want this feature enabled


shutdownExecutorPool

public void shutdownExecutorPool()

updateAllServerList

protected void updateAllServerList(java.util.List<T> ls)
Update the AllServer list in the LoadBalancer if necessary and enabled

Parameters:
ls -

toString

public java.lang.String toString()
Overrides:
toString in class BaseLoadBalancer