|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AsyncQueueWriter<L>
The AsyncQueue
, which implements asynchronous write queue.
Nested Class Summary | |
---|---|
static class |
AsyncQueueWriter.Reentrant
Write reentrants counter |
Nested classes/interfaces inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue |
---|
AsyncQueue.AsyncResult |
Field Summary | |
---|---|
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. |
Fields inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue |
---|
EXPECTING_MORE_OPTION |
Method Summary | |
---|---|
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. |
Methods inherited from interface org.glassfish.grizzly.Writer |
---|
write, write, write, write, write |
Methods inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue |
---|
close, isReady, onClose, processAsync |
Field Detail |
---|
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.
Method Detail |
---|
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 false
void 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
- 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.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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |