com.caucho.network.balance
Class ClientSocket

java.lang.Object
  extended by com.caucho.network.balance.ClientSocket
All Implemented Interfaces:
ClientSocketApi

public class ClientSocket
extends java.lang.Object
implements ClientSocketApi

Defines a connection to the client.


Method Summary
 void clearIdleStartTime()
          Sets the idle start time.
 void clearRecycle()
          Clears the recycled connections.
 void close()
           
 void free(long idleStartTime)
          Adds the stream to the free pool.
 java.lang.String getAddress()
           
 java.lang.String getDebugId()
          Returns the debug id.
 long getIdleStartTime()
          Returns the idle start time, i.e.
 ReadStream getInputStream()
          Returns the input stream.
 WriteStream getOutputStream()
          Returns the write stream.
 ClientSocketFactory getPool()
          Returns the owning pool
 boolean isAuthenticated()
          Returns true if the stream has been authenticated
 boolean isClosed()
           
 boolean isIdleAlmostExpired(long delta)
          Returns true if nearing end of free time.
 boolean isIdleExpired()
          Returns true if nearing end of free time.
 boolean isPoolSequenceIdValid()
          Returns true if the sequence id is valid.
 void setAuthenticated(boolean isAuthenticated)
          Returns true if the stream has been authenticated
 void setIdleStartTime(long idleStartTime)
          Sets the idle start time.
 void switchToHmtp(boolean isUnidir)
           
 void toActive()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getPool

public ClientSocketFactory getPool()
Returns the owning pool

Specified by:
getPool in interface ClientSocketApi

getInputStream

public ReadStream getInputStream()
Returns the input stream.

Specified by:
getInputStream in interface ClientSocketApi

getOutputStream

public WriteStream getOutputStream()
Returns the write stream.

Specified by:
getOutputStream in interface ClientSocketApi

isAuthenticated

public boolean isAuthenticated()
Returns true if the stream has been authenticated


setAuthenticated

public void setAuthenticated(boolean isAuthenticated)
Returns true if the stream has been authenticated


getIdleStartTime

public long getIdleStartTime()
Returns the idle start time, i.e. the time the connection was last idle.

Specified by:
getIdleStartTime in interface ClientSocketApi

setIdleStartTime

public void setIdleStartTime(long idleStartTime)
Sets the idle start time. Because of clock skew and tcp delays, it's often better to use the request start time instead of the request end time for the idle start time.

Specified by:
setIdleStartTime in interface ClientSocketApi

clearIdleStartTime

public void clearIdleStartTime()
Sets the idle start time.

Specified by:
clearIdleStartTime in interface ClientSocketApi

isIdleExpired

public boolean isIdleExpired()
Returns true if nearing end of free time.

Specified by:
isIdleExpired in interface ClientSocketApi

isIdleAlmostExpired

public boolean isIdleAlmostExpired(long delta)
Returns true if nearing end of free time.

Specified by:
isIdleAlmostExpired in interface ClientSocketApi

isPoolSequenceIdValid

public boolean isPoolSequenceIdValid()
Returns true if the sequence id is valid.

Specified by:
isPoolSequenceIdValid in interface ClientSocketApi

getAddress

public java.lang.String getAddress()

switchToHmtp

public void switchToHmtp(boolean isUnidir)

getDebugId

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

Specified by:
getDebugId in interface ClientSocketApi

clearRecycle

public void clearRecycle()
Clears the recycled connections.

Specified by:
clearRecycle in interface ClientSocketApi

free

public void free(long idleStartTime)
Adds the stream to the free pool. The idleStartTime may be earlier than the current time to deal with TCP buffer delays. Typically it will be recorded as the start time of the request's write.

Specified by:
free in interface ClientSocketApi
Parameters:
idleStartTime - the time to be used as the start of the idle period.

toActive

public void toActive()
Specified by:
toActive in interface ClientSocketApi

isClosed

public boolean isClosed()
Specified by:
isClosed in interface ClientSocketApi

close

public void close()
Specified by:
close in interface ClientSocketApi

toString

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