Package org.nustaq.kontraktor.asyncio
Class QueuingAsyncSocketConnection
java.lang.Object
org.nustaq.kontraktor.asyncio.AsyncSocketConnection
org.nustaq.kontraktor.asyncio.QueuingAsyncSocketConnection
- Direct Known Subclasses:
ObjectAsyncSocketConnection
Created by moelrue on 5/5/15.
A server socket connection which buffers incoming/outgoing data in a binary queue so
an application can easily parse and process data async in chunks without having
to maintain complex state machines.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic longprotected org.nustaq.offheap.BinaryQueueprotected org.nustaq.offheap.bytez.niobuffers.ByteBufferBasicBytezprotected org.nustaq.offheap.BinaryQueueFields inherited from class org.nustaq.kontraktor.asyncio.AsyncSocketConnection
chan, isClosed, key, myActor, readBuf, theExecutingThread, writePromise, writingBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoiddataReceived(ByteBuffer buf) protected abstract voiddataReceived(org.nustaq.offheap.BinaryQueue queue) voidtryFlush()voidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int val) voidwrite(ByteBuffer buf) Methods inherited from class org.nustaq.kontraktor.asyncio.AsyncSocketConnection
canWrite, checkThread, close, closed, directWrite, isClosed
-
Field Details
-
MAX_Q_SIZE_BYTES
public static long MAX_Q_SIZE_BYTES -
readQueue
protected org.nustaq.offheap.BinaryQueue readQueue -
writeQueue
protected org.nustaq.offheap.BinaryQueue writeQueue -
wrapper
protected org.nustaq.offheap.bytez.niobuffers.ByteBufferBasicBytez wrapper
-
-
Constructor Details
-
QueuingAsyncSocketConnection
-
-
Method Details
-
checkQSize
protected void checkQSize() -
write
-
write
public void write(byte[] b) -
write
public void write(byte[] b, int off, int len) -
write
public void write(int val) -
tryFlush
public void tryFlush() -
dataReceived
- Specified by:
dataReceivedin classAsyncSocketConnection
-
dataReceived
protected abstract void dataReceived(org.nustaq.offheap.BinaryQueue queue)
-