org.szegedi.nioserver.protocols
Class AbstractPipedProtocolHandler
java.lang.Object
|
+--org.szegedi.nioserver.protocols.AbstractPipedProtocolHandler
- All Implemented Interfaces:
- ProtocolHandler
- public abstract class AbstractPipedProtocolHandler
- extends java.lang.Object
- implements ProtocolHandler
|
Method Summary |
protected NonblockingPipe |
createOutputPipe(ByteBufferPool bufferPool)
|
protected abstract void |
doEndRead()
|
protected abstract void |
doEndWrite()
|
protected abstract boolean |
doRead()
|
boolean |
tryToRead()
Called when the socket channel is reported to be ready for reading. |
boolean |
tryToWrite()
Called when the socket channel is reported to be ready for writing. |
int |
validOps()
Returns a bit mask of SelectionKey.OP_XXX values that
represent the operations this handler supports. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
socketChannel
protected final java.nio.channels.SocketChannel socketChannel
outputPipe
protected final NonblockingPipe outputPipe
AbstractPipedProtocolHandler
protected AbstractPipedProtocolHandler(java.nio.channels.SocketChannel socketChannel,
ByteBufferPool bufferPool)
validOps
public int validOps()
- Description copied from interface:
ProtocolHandler
- Returns a bit mask of
SelectionKey.OP_XXX values that
represent the operations this handler supports. Most typically, this
will be SelectionKey.OP_READ | SelectionKey.OP_WRITE.
However, some protocols can be read-only or write-only, in which case
only the appropriate value should be returned.
- Specified by:
validOps in interface ProtocolHandler
tryToRead
public boolean tryToRead()
throws java.io.IOException
- Description copied from interface:
ProtocolHandler
- Called when the socket channel is reported to be ready for reading.
- Specified by:
tryToRead in interface ProtocolHandler
- Returns:
- true if the selection key associated with the connection on
the read thread should be cancelled, false otherwise.
java.io.IOException
tryToWrite
public boolean tryToWrite()
throws java.io.IOException
- Description copied from interface:
ProtocolHandler
- Called when the socket channel is reported to be ready for writing.
- Specified by:
tryToWrite in interface ProtocolHandler
- Returns:
- true if the selection key associated with the connection on
the write thread should be cancelled, false otherwise.
java.io.IOException
createOutputPipe
protected NonblockingPipe createOutputPipe(ByteBufferPool bufferPool)
doRead
protected abstract boolean doRead()
throws java.io.IOException
java.io.IOException
doEndRead
protected abstract void doEndRead()
throws java.io.IOException
java.io.IOException
doEndWrite
protected abstract void doEndWrite()
throws java.io.IOException
java.io.IOException