Package org.glassfish.grizzly.asyncqueue
Interface AsyncQueueWriter<L>
-
- Type Parameters:
L- the destination address type
- All Superinterfaces:
AsyncQueue,Writer<L>
- All Known Implementing Classes:
AbstractNIOAsyncQueueWriter,TCPNIOAsyncQueueWriter,UDPNIOAsyncQueueWriter
public interface AsyncQueueWriter<L> extends Writer<L>, AsyncQueue
TheAsyncQueue, which implements asynchronous write queue.- Author:
- Alexey Stashok, Ryan Lubke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue
AsyncQueue.AsyncResult
-
Nested classes/interfaces inherited from interface org.glassfish.grizzly.Writer
Writer.Reentrant
-
-
Field Summary
Fields Modifier and Type Field Description static intAUTO_SIZEConstant set viasetMaxPendingBytesPerConnection(int)means the async write queue size will be configured automatically perNIOConnectiondepending on connections write buffer size.static intUNLIMITED_SIZEConstant set viasetMaxPendingBytesPerConnection(int)means the async write queue size is unlimited.-
Fields inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue
EXPECTING_MORE_OPTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description booleancanWrite(Connection<L> connection, int size)Deprecated.the size parameter will be ignored, useWriter.canWrite(org.glassfish.grizzly.Connection)instead.intgetMaxPendingBytesPerConnection()booleanisAllowDirectWrite()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.voidnotifyWritePossible(Connection<L> connection, WriteHandler writeHandler, int size)Deprecated.the size parameter will be ignored, useinstead.voidsetAllowDirectWrite(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.voidsetMaxPendingBytesPerConnection(int maxQueuedWrites)Configures the maximum number of bytes pending to be written for a particularConnection.voidwrite(Connection<L> connection, L dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,L>> completionHandler, PushBackHandler pushBackHandler, MessageCloner<WritableMessage> cloner)Deprecated.push back logic is deprecated-
Methods inherited from interface org.glassfish.grizzly.asyncqueue.AsyncQueue
close, isReady, onClose, processAsync
-
-
-
-
Field Detail
-
UNLIMITED_SIZE
static final int UNLIMITED_SIZE
Constant set viasetMaxPendingBytesPerConnection(int)means the async write queue size is unlimited.- See Also:
- Constant Field Values
-
AUTO_SIZE
static final int AUTO_SIZE
Constant set viasetMaxPendingBytesPerConnection(int)means the async write queue size will be configured automatically perNIOConnectiondepending on connections write buffer size.- See Also:
- Constant Field Values
-
-
Method Detail
-
write
@Deprecated void write(Connection<L> connection, L dstAddress, WritableMessage message, CompletionHandler<WriteResult<WritableMessage,L>> completionHandler, PushBackHandler pushBackHandler, MessageCloner<WritableMessage> cloner)
Deprecated.push back logic is deprecatedMethod writes theBufferto the specific address.- Parameters:
connection- theConnectionto write todstAddress- the destination address theWritableMessagewill be sent tomessage- theWritableMessage, 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 queue
-
canWrite
@Deprecated boolean canWrite(Connection<L> connection, int size)
Deprecated.the size parameter will be ignored, useWriter.canWrite(org.glassfish.grizzly.Connection)instead.- Parameters:
connection- theConnectionto test whether or not the specified number of bytes can be written to.size- number of bytes to write.- Returns:
trueif the queue has not exceeded it's maximum size in bytes of pending writes, otherwisefalse- Since:
- 2.2
-
notifyWritePossible
@Deprecated void notifyWritePossible(Connection<L> connection, WriteHandler writeHandler, int size)
Deprecated.the size parameter will be ignored, useinstead.RegistersWriteHandler, which will be notified ones theConnectionis able to accept more bytes to be written. Note: using this method from different threads simultaneously may lead to quick situation changes, so at timeWriteHandleris called - the queue may become busy again.- Parameters:
connection-ConnectionwriteHandler-WriteHandlerto be notified.size- number of bytes queue has to be able to accept before notifyingWriteHandler.- Since:
- 2.2
-
setMaxPendingBytesPerConnection
void setMaxPendingBytesPerConnection(int maxQueuedWrites)
Configures the maximum number of bytes pending to be written for a particularConnection.- Parameters:
maxQueuedWrites- maximum number of bytes that may be pending to be written to a particularConnection.
-
getMaxPendingBytesPerConnection
int getMaxPendingBytesPerConnection()
- Returns:
- the maximum number of bytes that may be pending to be written to a particular
Connection. By default, this will be four times the size of theSocketsend buffer size.
-
isAllowDirectWrite
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.- 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.
-
setAllowDirectWrite
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.- Parameters:
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.
-
-