com.netflix.loadbalancer
Class DynamicServerListLoadBalancer<T extends Server>
java.lang.Object
com.netflix.loadbalancer.AbstractLoadBalancer
com.netflix.loadbalancer.BaseLoadBalancer
com.netflix.loadbalancer.DynamicServerListLoadBalancer<T>
- All Implemented Interfaces:
- com.netflix.client.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.
| Fields inherited from class com.netflix.loadbalancer.BaseLoadBalancer |
allServerList, allServerLock, lbStats, lbTimer, maxTotalPingTimeSeconds, name, ping, pingInProgress, pingIntervalSeconds, rule, serverComparator, upServerList, upServerLock |
| Methods inherited from class com.netflix.loadbalancer.BaseLoadBalancer |
addServer, addServerListChangeListener, addServers, cancelPingTask, choose, chooseServer, getClientConfig, getLoadBalancerStats, getMaxTotalPingTime, getName, getPing, getPingInterval, getPrimeConnections, getRule, getServerByIndex, getServerCount, getServerList, getServerList, init, isEnablePrimingConnections, isPingInProgress, lockAllServerList, lockUpServerList, markServerDown, markServerDown, primeCompleted, removeServerListChangeListener, setEnablePrimingConnections, setLoadBalancerStats, setMaxTotalPingTime, setPingInterval, setPrimeConnections, setRule |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
serverListUpdateInProgress
protected java.util.concurrent.atomic.AtomicBoolean serverListUpdateInProgress
serverRefreshEnabled
protected volatile boolean serverRefreshEnabled
DynamicServerListLoadBalancer
public DynamicServerListLoadBalancer()
DynamicServerListLoadBalancer
public DynamicServerListLoadBalancer(com.netflix.client.config.IClientConfig clientConfig,
IRule rule,
IPing ping,
ServerList<T> serverList,
ServerListFilter<T> filter)
DynamicServerListLoadBalancer
public DynamicServerListLoadBalancer(com.netflix.client.config.IClientConfig clientConfig)
initWithNiwsConfig
public void initWithNiwsConfig(com.netflix.client.config.IClientConfig clientConfig)
- Specified by:
initWithNiwsConfig in interface com.netflix.client.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
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
stopServerListRefreshing
public void stopServerListRefreshing()
updateListOfServers
public void updateListOfServers()
updateAllServerList
protected void updateAllServerList(java.util.List<T> ls)
- Update the AllServer list in the LoadBalancer if necessary and enabled
- Parameters:
ls -
getNumberMissedCycles
@Monitor(name="NumUpdateCyclesMissed",
type=GAUGE)
public int getNumberMissedCycles()
getLastUpdate
@Monitor(name="LastUpdated",
type=INFORMATIONAL)
public java.lang.String getLastUpdate()
getCoreThreads
@Monitor(name="NumThreads",
type=GAUGE)
public int getCoreThreads()
toString
public java.lang.String toString()
- Overrides:
toString in class BaseLoadBalancer
shutdown
public void shutdown()
- Overrides:
shutdown in class BaseLoadBalancer