Package org.nustaq.kontraktor.asyncio
Class AsyncSocketConnection
java.lang.Object
org.nustaq.kontraktor.asyncio.AsyncSocketConnection
- Direct Known Subclasses:
QueuingAsyncSocketConnection
Baseclass for handling async io. Its strongly recommended to use QueuingAsyncSocketConnection as this
eases things.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SocketChannelprotected booleanprotected SelectionKeyprotected Executorprotected ByteBufferprotected Threadwrites given buffer content.protected Promiseprotected ByteBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanWrite()protected voidvoidclose()abstract voidabstract voiddataReceived(ByteBuffer buf) protected IPromisedirectWrite(ByteBuffer buf) booleanisClosed()
-
Field Details
-
readBuf
-
key
-
chan
-
writePromise
-
writingBuffer
-
isClosed
protected boolean isClosed -
myActor
-
theExecutingThread
writes given buffer content. In case of partial write, another write is enqueued internally. once the write is completed, the returned promise is fulfilled. the next write has to wait until the future has completed, else write order might get mixed up. Better use write* methods of QueuingAsyncSocketConnection as these will write to a binary queue which is read+sent behind the scenes in parallel.
-
-
Constructor Details
-
AsyncSocketConnection
-
-
Method Details
-
closed
-
close
- Throws:
IOException
-
checkThread
protected void checkThread() -
directWrite
-
canWrite
public boolean canWrite() -
dataReceived
-
isClosed
public boolean isClosed()
-