java.lang.Object
java.net.Socket
com.go.trove.net.LazySocket
- class LazySocket
- extends java.net.Socket
A socket implementation that lazily establishs a connection. It only
connects when actually needed. Setting options and getting I/O streams will
not force a connection to be established. As soon as a read or write
operation is performed, a connection is established.
If the first write operation requires a connection to be established, then a
recycled connection is requested. The connection is tested by writing the
data to it. If this fails, a new connection is requested and the operation
is tried again.
- Version:
- 7 , 00/12/05
| Fields inherited from class java.net.Socket |
|
|
Method Summary |
(package private) CheckedSocket |
recycle()
Returns the internal wrapped socket or null if not connected. |
| Methods inherited from class java.net.Socket |
bind, close, connect, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString |
mImpl
private final LazySocket.Impl mImpl
LazySocket
public LazySocket(SocketFactory factory)
throws java.net.SocketException
LazySocket
public LazySocket(SocketFactory factory,
java.lang.Object session)
throws java.net.SocketException
LazySocket
public LazySocket(SocketFactory factory,
long timeout)
throws java.net.SocketException
LazySocket
public LazySocket(SocketFactory factory,
java.lang.Object session,
long timeout)
throws java.net.SocketException
LazySocket
private LazySocket(LazySocket.Impl impl)
throws java.net.SocketException
recycle
CheckedSocket recycle()
- Returns the internal wrapped socket or null if not connected. After
calling recycle, this LazySocket instance is closed.