public interface AsyncQueueWriter<L> extends Writer<L>, AsyncQueue
AsyncQueue, which implements asynchronous write queue.| Modifier and Type | Interface and Description |
|---|---|
static class |
AsyncQueueWriter.Reentrant
Write reentrants counter
|
AsyncQueue.AsyncResult| Modifier and Type | Field and Description |
|---|---|
static int |
AUTO_SIZE
Constant set via
setMaxPendingBytesPerConnection(int) means
the async write queue size will be configured automatically per
NIOConnection depending on connections write buffer size. |
static int |
UNLIMITED_SIZE
Constant set via
setMaxPendingBytesPerConnection(int) means
the async write queue size is unlimited. |
EXPECTING_MORE_OPTION| Modifier and Type | Method and Description |
|---|---|
boolean |
canWrite(Connection connection,
int size) |
int |
getMaxPendingBytesPerConnection() |
int |
getMaxWriteReentrants()
Returns the maximum number of write() method reentrants a thread
is allowed to made.
|
AsyncQueueWriter.Reentrant |
getWriteReentrant()
Returns the current write reentrants counter.
|
boolean |
isMaxReentrantsReached(AsyncQueueWriter.Reentrant reentrant)
Returns true, if max number of write->completion-handler reentrants
has been reached for the passed
AsyncQueueWriter.Reentrant object, and next write
will happen in the separate thread. |
void |
notifyWritePossible(Connection connection,
WriteHandler writeHandler,
int size)
Registers
WriteHandler, which will be notified ones Buffer
of "size"-bytes can be written. |
void |
setMaxPendingBytesPerConnection(int maxQueuedWrites)
Configures the maximum number of bytes pending to be written
for a particular
Connection. |
void |
setMaxWriteReentrants(int maxWriteReentrants)
Sets the maximum number of write() method reentrants a thread
is allowed to made.
|
void |
write(Connection connection,
SocketAddress dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler,
PushBackHandler pushBackHandler,
MessageCloner<WritableMessage> cloner)
Method writes the
Buffer to the specific address. |
close, isReady, onClose, processAsyncstatic final int UNLIMITED_SIZE
setMaxPendingBytesPerConnection(int) means
the async write queue size is unlimited.static final int AUTO_SIZE
setMaxPendingBytesPerConnection(int) means
the async write queue size will be configured automatically per
NIOConnection depending on connections write buffer size.void write(Connection connection, SocketAddress dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,SocketAddress>> completionHandler, PushBackHandler pushBackHandler, MessageCloner<WritableMessage> cloner)
Buffer to the specific address.connection - the Connection to write todstAddress - the destination address the WritableMessage will be
sent tomessage - the WritableMessage, from which the data will be writtencompletionHandler - CompletionHandler,
which will get notified, when write will be completedpushBackHandler - PushBackHandler, which will be notified
if message was accepted by transport write queue or refusedcloner - MessageCloner, which will be invoked by
AsyncQueueWriter, if message could not be written to a
channel directly and has to be put on a asynchronous queueboolean canWrite(Connection connection, int size)
connection - the Connection to test whether or not the
specified number of bytes can be written to.size - number of bytes to write.true if the queue has not exceeded it's maximum
size in bytes of pending writes, otherwise falsevoid notifyWritePossible(Connection connection, WriteHandler writeHandler, int size)
WriteHandler, which will be notified ones Buffer
of "size"-bytes can be written.
Note: using this method from different threads simultaneously may lead
to quick situation changes, so at time WriteHandler is called -
the queue may become busy again. It's recommended to use this method
together with PushBackHandler to have a chance to handle
such a situations properly.connection - ConnectionwriteHandler - WriteHandler to be notified.size - number of bytes queue has to be able to accept before notifying
WriteHandler.void setMaxPendingBytesPerConnection(int maxQueuedWrites)
Connection.maxQueuedWrites - maximum number of bytes that may be pending to be
written to a particular Connection.int getMaxPendingBytesPerConnection()
Connection. By default, this will be four
times the size of the Socket send buffer size.int getMaxWriteReentrants()
void setMaxWriteReentrants(int maxWriteReentrants)
maxWriteReentrants - the maximum number of write() method calls
a thread is allowed to make.AsyncQueueWriter.Reentrant getWriteReentrant()
canWrite(org.glassfish.grizzly.Connection, int) and
various write methods.boolean isMaxReentrantsReached(AsyncQueueWriter.Reentrant reentrant)
AsyncQueueWriter.Reentrant object, and next write
will happen in the separate thread.reentrant - AsyncQueueWriter.Reentrant object.AsyncQueueWriter.Reentrant object, and next write
will happen in the separate thread.Copyright © 2013 Oracle Corporation. All Rights Reserved.