final class SocketChannelConnectionIO extends ConnectionIO
Modifier and Type | Class and Description |
---|---|
private class |
SocketChannelConnectionIO.Handler |
Modifier and Type | Field and Description |
---|---|
private ByteBuffer[] |
bufferPair |
private SocketChannel |
channel
socket channel for underlying connection
|
private static String |
detailMessage4854354
detail message of IOException thrown when 4854354 occurs
|
private ByteBuffer |
inputBuffer
buffer for reading incoming data from connection
|
private static int |
IOV_MAX |
private SelectionManager.Key |
key |
private static Logger |
logger
mux logger
|
private LinkedList |
notifyQueue
queue of alternating buffers (that are in sendQueue) and IOFuture
objects that need to be notified when those buffers are written
|
private ByteBuffer[] |
preallocBufferArray |
private static int |
RECEIVE_BUFFER_SIZE |
private static SelectionManager |
selectionManager
selection manager used by this implementation
|
private LinkedList |
sendQueue
queue of buffers of data to be sent over connection
|
mux
Constructor and Description |
---|
SocketChannelConnectionIO(Mux mux,
SocketChannel channel)
Creates a new SocketChannelConnectionIO for the connection represented
by the supplied SocketChannel.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
asyncSend(ByteBuffer buffer)
Sends the sequence of bytes contained in the supplied buffer to the
underlying connection.
|
(package private) void |
asyncSend(ByteBuffer first,
ByteBuffer second)
Sends the sequence of bytes contained in the supplied buffers to the
underlying connection.
|
private void |
drainNotifyQueue() |
(package private) IOFuture |
futureSend(ByteBuffer first,
ByteBuffer second)
Sends the sequence of bytes contained in the supplied buffers to the
underlying connection.
|
private void |
handleReadReady() |
private void |
handleWriteReady() |
(package private) void |
start()
Starts processing connection data.
|
private static final int RECEIVE_BUFFER_SIZE
private static final int IOV_MAX
private static final Logger logger
private static final SelectionManager selectionManager
private static final String detailMessage4854354
private final SocketChannel channel
private final SelectionManager.Key key
private final LinkedList sendQueue
private final LinkedList notifyQueue
private final ByteBuffer inputBuffer
private final ByteBuffer[] bufferPair
private final ByteBuffer[] preallocBufferArray
SocketChannelConnectionIO(Mux mux, SocketChannel channel) throws IOException
IOException
void start() throws IOException
start
in class ConnectionIO
IOException
void asyncSend(ByteBuffer buffer)
ConnectionIO
asyncSend
in class ConnectionIO
void asyncSend(ByteBuffer first, ByteBuffer second)
ConnectionIO
asyncSend
in class ConnectionIO
IOFuture futureSend(ByteBuffer first, ByteBuffer second)
ConnectionIO
futureSend
in class ConnectionIO
private void handleWriteReady()
private void drainNotifyQueue()
private void handleReadReady()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.