Top Description Fields Methods
org.glassfish.grizzly.asyncqueue

public Interface AsyncQueueWriter<L>

extends Writer<L>, AsyncQueue
Known Direct Implementers
org.glassfish.grizzly.nio.AbstractNIOAsyncQueueWriter
Annotations
@SuppressWarnings:deprecation
Type Parameters
<L>
the destination address type
Imports
org.glassfish.grizzly.Buffer, .CompletionHandler, .Connection, .WriteHandler, .WriteResult, .Writer, org.glassfish.grizzly.nio.NIOConnection

The AsyncQueue, which implements asynchronous write queue.
Authors
Alexey Stashok, Ryan Lubke

Field Summary

Modifier and TypeField and Description
public static final 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.

public static final int
UNLIMITED_SIZE

Constant set via setMaxPendingBytesPerConnection(int) means the async write queue size is unlimited.

Inherited from org.glassfish.grizzly.asyncqueue.AsyncQueue:
EXPECTING_MORE_OPTION

Method Summary

Modifier and TypeMethod and Description
public boolean
canWrite(final Connection<L>
the Connection to test whether or not the specified number of bytes can be written to.
connection
,
int
number of bytes to write.
size
)
Deprecated the size parameter will be ignored, use canWrite(org.glassfish.grizzly.Connection) instead.

Returns: true if the queue has not exceeded it's maximum size in bytes of pending writes, otherwise false

public int
getMaxPendingBytesPerConnection()

Returns: the maximum number of bytes that may be pending to be written to a particular Connection.

public boolean

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.
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.

public void
notifyWritePossible(final Connection<L> connection, final WriteHandler
WriteHandler to be notified.
writeHandler
,
final int
number of bytes queue has to be able to accept before notifying WriteHandler.
size
)
Deprecated the size parameter will be ignored, use {@link #notifyWritePossible(org.glassfish.grizzly.Connection, org.glassfish.grizzly.WriteHandler) instead.

Registers WriteHandler, which will be notified ones the Connection is able to accept more bytes to be written.

public void
setAllowDirectWrite(final boolean
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.
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.

public void
setMaxPendingBytesPerConnection(final int
maximum number of bytes that may be pending to be written to a particular Connection.
maxQueuedWrites
)

Configures the maximum number of bytes pending to be written for a particular Connection.

public void
write(Connection<L> connection, L
the destination address the WritableMessage will be sent to
dstAddress
,
WritableMessage
the WritableMessage, from which the data will be written
message
,
CompletionHandler<WriteResult<WritableMessage, L>>
org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed
completionHandler
,
PushBackHandler
PushBackHandler, which will be notified if message was accepted by transport write queue or refused
pushBackHandler
,
MessageCloner<WritableMessage>
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
cloner
)
Deprecated push back logic is deprecated

Method writes the Buffer to the specific address.

Inherited from org.glassfish.grizzly.asyncqueue.AsyncQueue:
closeisReadyonCloseprocessAsync
Inherited from org.glassfish.grizzly.Writer:
canWritenotifyWritePossiblewritewritewritewritewritewrite

Field Detail

AUTO_SIZEback to summary
public static final 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.

UNLIMITED_SIZEback to summary
public static final int UNLIMITED_SIZE

Constant set via setMaxPendingBytesPerConnection(int) means the async write queue size is unlimited.

Method Detail

canWriteback to summary
public boolean canWrite(final Connection<L> connection, int size)

Deprecated

the size parameter will be ignored, use canWrite(org.glassfish.grizzly.Connection) instead.

Parameters
connection:Connection<L>

the Connection to test whether or not the specified number of bytes can be written to.

size:int

number of bytes to write.

Returns:boolean

true if the queue has not exceeded it's maximum size in bytes of pending writes, otherwise false

Annotations
@Deprecated
Since
2.2
getMaxPendingBytesPerConnectionback to summary
public int getMaxPendingBytesPerConnection()
Returns:int

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 the java.net.Socket send buffer size.

isAllowDirectWriteback to summary
public 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:boolean

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.

notifyWritePossibleback to summary
public void notifyWritePossible(final Connection<L> connection, final WriteHandler writeHandler, final int size)

Deprecated

the size parameter will be ignored, use {@link #notifyWritePossible(org.glassfish.grizzly.Connection, org.glassfish.grizzly.WriteHandler) instead.

Registers 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.

Parameters
connection:Connection<L>

Connection

writeHandler:WriteHandler

WriteHandler to be notified.

size:int

number of bytes queue has to be able to accept before notifying WriteHandler.

Annotations
@Deprecated
Since
2.2
setAllowDirectWriteback to summary
public void setAllowDirectWrite(final 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:boolean

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.

setMaxPendingBytesPerConnectionback to summary
public void setMaxPendingBytesPerConnection(final int maxQueuedWrites)

Configures the maximum number of bytes pending to be written for a particular Connection.

Parameters
maxQueuedWrites:int

maximum number of bytes that may be pending to be written to a particular Connection.

writeback to summary
public 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

Method writes the Buffer to the specific address.

Parameters
connection:Connection<L>

the org.glassfish.grizzly.Connection to write to

dstAddress:L

the destination address the WritableMessage will be sent to

message:WritableMessage

the WritableMessage, from which the data will be written

completionHandler:CompletionHandler<WriteResult<WritableMessage, L>>

org.glassfish.grizzly.CompletionHandler, which will get notified, when write will be completed

pushBackHandler:PushBackHandler

PushBackHandler, which will be notified if message was accepted by transport write queue or refused

cloner:MessageCloner<WritableMessage>

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

Annotations
@Deprecated