L
- the destination address typepublic interface AsyncQueueWriter<L> extends Writer<L>, AsyncQueue
AsyncQueue
, which implements asynchronous write queue.Writer.Reentrant
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<L> connection,
int size)
Deprecated.
the size parameter will be ignored, use
Writer.canWrite(org.glassfish.grizzly.Connection) instead. |
int |
getMaxPendingBytesPerConnection() |
boolean |
isAllowDirectWrite()
Returns true, if async write queue is allowed to write buffer
directly during write(...) method call, w/o adding buffer to the
queue, or false otherwise.
|
void |
notifyWritePossible(Connection<L> connection,
WriteHandler writeHandler,
int size)
Deprecated.
the size parameter will be ignored, use {@link #notifyWritePossible(org.glassfish.grizzly.Connection, org.glassfish.grizzly.WriteHandler) instead.
|
void |
setAllowDirectWrite(boolean isAllowDirectWrite)
Set true, if async write queue is allowed to write buffer
directly during write(...) method call, w/o adding buffer to the
queue, or false otherwise.
|
void |
setMaxPendingBytesPerConnection(int maxQueuedWrites)
Configures the maximum number of bytes pending to be written
for a particular
Connection . |
void |
write(Connection<L> connection,
L dstAddress,
WritableMessage message,
CompletionHandler<WriteResult<WritableMessage,L>> completionHandler,
PushBackHandler pushBackHandler,
MessageCloner<WritableMessage> cloner)
Deprecated.
push back logic is deprecated
|
canWrite, notifyWritePossible, write, write, write, write, write, write
close, isReady, onClose, processAsync
static 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<L> connection, L dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,L>> 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<L> connection, int size)
Writer.canWrite(org.glassfish.grizzly.Connection)
instead.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 false
void notifyWritePossible(Connection<L> connection, WriteHandler writeHandler, int size)
WriteHandler
, which will be notified ones the
Connection
is able to accept more bytes to 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.connection
- Connection
writeHandler
- 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.boolean isAllowDirectWrite()
void setAllowDirectWrite(boolean isAllowDirectWrite)
isAllowDirectWrite
- true, if async write queue is allowed
to write buffer directly during write(...) method call, w/o adding buffer
to the queue, or false otherwise.Copyright © 2015 Oracle Corporation. All rights reserved.