|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.officefloor.plugin.socket.server.tcp.protocol.TcpConnectionHandler
public class TcpConnectionHandler
TCP ConnectionHandler.
| Constructor Summary | |
|---|---|
TcpConnectionHandler(Connection connection,
long maxIdleTime)
Initiate. |
|
| Method Summary | |
|---|---|
InputBufferStream |
getInputBufferStream()
Obtains the InputBufferStream that provides access to the data
sent from the client. |
Object |
getLock()
Obtains the lock that may be synchronized on to reduce
locking overhead of making multiple calls on this
ServerTcpConnection. |
Object |
getObject()
|
OutputBufferStream |
getOutputBufferStream()
Obtains the OutputBufferStream to write data back to the client. |
void |
handleIdleConnection(IdleContext context)
Handles a Connection being idled. |
void |
handleRead(ReadContext context)
Handles a read from the SocketChannel. |
void |
handleWrite(WriteContext context)
Handles a potential write to the SocketChannel. |
void |
invokeProcess(int newConnectionFlowIndex,
ManagedObjectExecuteContext<Indexed> executeContext)
Called by the TcpServer to start processing the
Connection of this ConnectionHandler. |
void |
registerAsynchronousCompletionListener(AsynchronousListener listener)
|
void |
waitOnClientData()
Flags for the ManagedObject to not execute another Task
until further data is received from the client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TcpConnectionHandler(Connection connection,
long maxIdleTime)
connection - Connection.maxIdleTime - Maximum idle time for the Connection measured in
milliseconds.| Method Detail |
|---|
public void invokeProcess(int newConnectionFlowIndex,
ManagedObjectExecuteContext<Indexed> executeContext)
Called by the TcpServer to start processing the
Connection of this ConnectionHandler.
Called within the lock on the Connection.
newConnectionFlowIndex - Flow index to handle a new connection.executeContext - ManagedObjectExecuteContext.
public void handleIdleConnection(IdleContext context)
throws IOException
ConnectionHandlerConnection being idled.
handleIdleConnection in interface ConnectionHandlercontext - IdleContext.
IOException - If fails to handle idle Connection. Possibly from
attempting to close it.
public void handleRead(ReadContext context)
throws IOException
ConnectionHandlerSocketChannel.
handleRead in interface ConnectionHandlercontext - ReadContext.
IOException - If fails to obtain data from the ReadContext.public void handleWrite(WriteContext context)
ConnectionHandlerSocketChannel.
handleWrite in interface ConnectionHandlercontext - WriteContext.public void registerAsynchronousCompletionListener(AsynchronousListener listener)
registerAsynchronousCompletionListener in interface AsynchronousManagedObjectpublic Object getObject()
getObject in interface ManagedObjectpublic Object getLock()
ServerTcpConnectionsynchronized on to reduce
locking overhead of making multiple calls on this
ServerTcpConnection. In other words, it allows course grained
locking.
getLock in interface ServerTcpConnectionServerTcpConnection.public InputBufferStream getInputBufferStream()
ServerTcpConnectionInputBufferStream that provides access to the data
sent from the client.
getInputBufferStream in interface ServerTcpConnectionInputBufferStream.
public void waitOnClientData()
throws IOException
ServerTcpConnection
Flags for the ManagedObject to not execute another Task
until further data is received from the client.
On calling this the next time a Task is invoked using this
ManagedObject, data will be available from the
InputBufferStream.
waitOnClientData in interface ServerTcpConnectionIOException - If fails to initiate waiting on client.public OutputBufferStream getOutputBufferStream()
ServerTcpConnection
Obtains the OutputBufferStream to write data back to the client.
Closing the OutputBufferStream will result in closing the
Connection.
getOutputBufferStream in interface ServerTcpConnectionOutputBufferStream.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||