com.caucho.network.balance
Class ClientNetworkState

java.lang.Object
  extended by com.caucho.network.balance.ClientNetworkState

public class ClientNetworkState
extends java.lang.Object

State of a network connection to a target server.

Fail Recover Time

The fail recover time is dynamic. The first timeout is 1s. After the 1s, the client tries again. If that fails, the timeout is doubled until reaching the maximum _loadBalanceRecoverTime.


Constructor Summary
ClientNetworkState(java.lang.String id, long recoverTimeout)
           
 
Method Summary
 void close()
          Close the client
 void completeConnection()
           
 void disable()
          Disable the client.
 void enable()
          Enable the client.
 java.lang.String getId()
          Returns the user-readable id of the target server.
 long getRecoverTimeout()
          Return the max recover time.
 java.lang.String getState()
          Returns the lifecycle state.
 boolean isActive()
          Returns true if the server is active.
 boolean isDead()
          Returns true if the server is dead.
 boolean isEnabled()
          Return true if enabled.
 void onFail()
          Called when the connection fails.
 void onSuccess()
          Called when the server has a successful response
 boolean startConnection()
          Start a new connection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClientNetworkState

public ClientNetworkState(java.lang.String id,
                          long recoverTimeout)
Method Detail

getId

public java.lang.String getId()
Returns the user-readable id of the target server.


getRecoverTimeout

public long getRecoverTimeout()
Return the max recover time.


getState

public final java.lang.String getState()
Returns the lifecycle state.


isActive

public final boolean isActive()
Returns true if the server is active.


isEnabled

public boolean isEnabled()
Return true if enabled.


isDead

public final boolean isDead()
Returns true if the server is dead.


enable

public void enable()
Enable the client.


disable

public void disable()
Disable the client.


onSuccess

public void onSuccess()
Called when the server has a successful response


onFail

public void onFail()
Called when the connection fails.


startConnection

public boolean startConnection()
Start a new connection. Returns true if the connection can be started.


completeConnection

public void completeConnection()

close

public void close()
Close the client


toString

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