com.caucho.servlets
Class LoadBalanceStrategy

java.lang.Object
  extended by com.caucho.servlets.LoadBalanceStrategy
Direct Known Subclasses:
LeastConnectionBalanceStrategy, RoundRobinBalanceStrategy

public abstract class LoadBalanceStrategy
extends java.lang.Object

Strategy for selecting the next server


Field Summary
protected  ServerConnector[] _serverGroup
           
 
Constructor Summary
LoadBalanceStrategy()
           
 
Method Summary
protected  int nextRoundRobin()
          Returns the index of the next round-robin server.
protected  ClusterStream openBestServer(int startIndex, ServerConnector oldClient)
          Opens the best load balance server.
 ClusterStream openServer(ServerConnector oldClient)
          Opens the next available server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_serverGroup

protected ServerConnector[] _serverGroup
Constructor Detail

LoadBalanceStrategy

public LoadBalanceStrategy()
Method Detail

openServer

public final ClusterStream openServer(ServerConnector oldClient)
Opens the next available server.

Parameters:
oldClient - on failover, the client which failed with 503
Returns:
the next available server

openBestServer

protected ClusterStream openBestServer(int startIndex,
                                       ServerConnector oldClient)
Opens the best load balance server.

Parameters:
oldClient - on failover, the client which failed with 503

nextRoundRobin

protected int nextRoundRobin()
Returns the index of the next round-robin server.