com.caucho.cloud.loadbalance
Class AbstractLoadBalanceStrategy

java.lang.Object
  extended by com.caucho.cloud.loadbalance.AbstractLoadBalanceStrategy
Direct Known Subclasses:
LeastConnectionBalanceStrategy, RoundRobinBalanceStrategy

public abstract class AbstractLoadBalanceStrategy
extends java.lang.Object

Strategy for selecting the next server


Constructor Summary
protected AbstractLoadBalanceStrategy(LoadBalanceClientGroup clientGroup)
           
 
Method Summary
protected  ClientSocketFactory[] getClientList()
           
protected  int nextRoundRobin()
          Returns the index of the next round-robin server.
protected  ClientSocket openBestServer(int startIndex, ClientSocketFactory oldClient)
          Opens the best load balance server.
 ClientSocket openServer(ClientSocketFactory oldClient)
          Opens the next available server.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractLoadBalanceStrategy

protected AbstractLoadBalanceStrategy(LoadBalanceClientGroup clientGroup)
Method Detail

getClientList

protected ClientSocketFactory[] getClientList()

openServer

public final ClientSocket openServer(ClientSocketFactory oldClient)
Opens the next available server.

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

openBestServer

protected ClientSocket openBestServer(int startIndex,
                                      ClientSocketFactory 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.


toString

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