au.com.terabit.jproactor
Class TCPAsynchChannel
java.lang.Object
au.com.terabit.jproactor.AsynchChannel
au.com.terabit.jproactor.TCPAsynchChannel
public final class TCPAsynchChannel
- extends AsynchChannel
The TCPAsynchChannel is an intermidiate interface that serves as
mediator between Demultiplexor and AsynchHandler
All implemented protocols should be based on this interface.
- Version:
$Revision$ $Date$
- Author:
- Yevgeny Libman
- See Also:
IOOperation
|
Constructor Summary |
TCPAsynchChannel(Demultiplexor m,
java.nio.channels.SelectableChannel sc)
Creates TCPAsynchChannel instance given specified
Demultiplexor, AsynchHandler and
SelectableChannel instances. |
| Methods inherited from class au.com.terabit.jproactor.AsynchChannel |
accept, checkForClose, close, connect, dispatchCompletions, enqueueOperation, executeListAndAdd, executeListAndDispatch, executeOp, executeOpAndAdd, getChannelHandler, isClosed, isCloseFinished, isCloseStarted, isConnected, isOpened, read_n, read, schedulerTimer, setChannelHandler, setClosing, setConnected, write_n, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TCPAsynchChannel
public TCPAsynchChannel(Demultiplexor m,
java.nio.channels.SelectableChannel sc)
- Creates
TCPAsynchChannel instance given specified
Demultiplexor, AsynchHandler and
SelectableChannel instances.
- Parameters:
m - Demultiplexor instance this m_asynchChannel works withp - AsynchHandler protocol instancesc - SelectableChannel instance this m_asynchChannel operates on
finishRead
protected int finishRead(OpRead op)
throws java.lang.Exception
- Specified by:
finishRead in class AsynchChannel
- Returns:
- > 0 number bytes read
0 not finished yet
< 0 errors or end of data
- Throws:
java.lang.Exception
finishWrite
protected int finishWrite(OpWrite op)
throws java.lang.Exception
- Writes data into associated channel, when channel is ready for
non-blocking write.
- Specified by:
finishWrite in class AsynchChannel
- Returns:
- > 0 number bytes written
0 not finished yet
< 0 errors or peer closed
- Throws:
java.lang.Exception- See Also:
IOOperation.execute()
finishAccept
protected AsynchChannel finishAccept(OpAccept op)
throws java.lang.Exception
- Specified by:
finishAccept in class AsynchChannel
- Returns:
- new accepted AsynchChannel
null not finished yet
- Throws:
java.lang.Exception
finishConnect
protected boolean finishConnect(OpConnect op)
throws java.lang.Exception
- Specified by:
finishConnect in class AsynchChannel
- Returns:
- true if connect finished
false if not
may be to fix:
1 finished OK,
0 not finished yet
-1 finished with errors
- Throws:
java.lang.Exception
startClose
public boolean startClose()
- Specified by:
startClose in class AsynchChannel
startRead
protected void startRead(OpRead op)
throws java.lang.Exception
- Specified by:
startRead in class AsynchChannel
- Throws:
java.lang.Exception
startWrite
protected void startWrite(OpWrite op)
throws java.lang.Exception
- Specified by:
startWrite in class AsynchChannel
- Throws:
java.lang.Exception
startAccept
protected void startAccept(OpAccept op)
throws java.lang.Exception
- Specified by:
startAccept in class AsynchChannel
- Throws:
java.lang.Exception
startConnect
protected void startConnect(OpConnect op)
throws java.lang.Exception
- Specified by:
startConnect in class AsynchChannel
- Throws:
java.lang.Exception
startTimer
public void startTimer(OpTimer op)
- Schedules timeout action to be called back on the associated
AsynchHandler instance.
Note: while IO operations will be delivered to the handler in a
serialized way, timer notifications might be delivered concurrently.
- Specified by:
startTimer in class AsynchChannel
- Parameters:
delay - delay in milliseconds before timeout action is to be executed.