com.caucho.network.balance
Interface ClientSocketFactoryApi

All Known Implementing Classes:
ClientSocketFactory

public interface ClientSocketFactoryApi

A pool of connections to a server.


Method Summary
 void busy()
          Called when the server responds with "busy", e.g.
 boolean canOpenWarm()
          Returns true if the server can open a connection.
 boolean canOpenWarmOrRecycle()
          Returns true if the server can open a connection.
 void clearRecycle()
          Clears the recycled connections, e.g.
 void close()
          Close the client
 void disable()
          Disable the client
 void enable()
          Enable the client
 void enableSessionOnly()
          Session only
 void failConnect()
          Called when the socket read/write fails.
 void failSocket()
          Called when the socket read/write fails.
 java.lang.String getAddress()
          Returns the hostname of the target server.
 java.lang.String getDebugId()
          Returns the debug id.
 java.lang.String getId()
          Returns the user-readable id of the target server.
 int getPort()
          Gets the port of the target server.
 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 active.
 void notifyHeartbeatStart()
          Notify that a start has occurred.
 void notifyHeartbeatStop()
          Notify that a stop has occurred.
 ClientSocket open()
          Open a stream to the target server for the load balancer.
 ClientSocket openIfLive()
          Open a stream to the target server object persistence.
 ClientSocket openSticky()
          Open a stream to the target server for a session.
 ClientSocket openWarm()
          Open a stream to the target server.
 void start()
          Enable the client.
 void stop()
          Disable the client.
 void success()
          Called when the server has a successful response
 void toBusy()
           
 void toFail()
           
 void wake()
          We now know that the server is live, e.g.
 

Method Detail

getId

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


getDebugId

java.lang.String getDebugId()
Returns the debug id.


getAddress

java.lang.String getAddress()
Returns the hostname of the target server.


getPort

int getPort()
Gets the port of the target server.


isActive

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


isDead

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


enable

void enable()
Enable the client


disable

void disable()
Disable the client


getState

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


canOpenWarmOrRecycle

boolean canOpenWarmOrRecycle()
Returns true if the server can open a connection.


canOpenWarm

boolean canOpenWarm()
Returns true if the server can open a connection.


isEnabled

boolean isEnabled()
Return true if active.


toBusy

void toBusy()

toFail

void toFail()

failSocket

void failSocket()
Called when the socket read/write fails.


failConnect

void failConnect()
Called when the socket read/write fails.


busy

void busy()
Called when the server responds with "busy", e.g. HTTP 503


success

void success()
Called when the server has a successful response


start

void start()
Enable the client.


stop

void stop()
Disable the client.


enableSessionOnly

void enableSessionOnly()
Session only


openWarm

ClientSocket openWarm()
Open a stream to the target server.

Returns:
the socket's read/write pair.

openIfLive

ClientSocket openIfLive()
Open a stream to the target server object persistence.

Returns:
the socket's read/write pair.

openSticky

ClientSocket openSticky()
Open a stream to the target server for a session.

Returns:
the socket's read/write pair.

open

ClientSocket open()
Open a stream to the target server for the load balancer.

Returns:
the socket's read/write pair.

wake

void wake()
We now know that the server is live, e.g. if a sibling has contacted us.


notifyHeartbeatStart

void notifyHeartbeatStart()
Notify that a start has occurred.


notifyHeartbeatStop

void notifyHeartbeatStop()
Notify that a stop has occurred.


clearRecycle

void clearRecycle()
Clears the recycled connections, e.g. on detection of backend server going down.


close

void close()
Close the client