users@grizzly.java.net

Binding the Async Write Queue

From: Dave <dave.davoren_at_gmail.com>
Date: Tue, 3 Nov 2015 14:43:59 +0000

Hi,

I am looking at a method to bind the Async write queue when using a
TCPNIOConnection to a specific number of application packets or bytes.
 From the documentation I found the following setting which I thought
would do the trick:

maxAsyncWriteQueueSizeInBytes

When I dug into the code I seen in order to use this I would have to
register a WriteHandler via the notifyCanWrite(...) API. This is
triggered after the queue has been serviced i.e. at least one packet
must be written to the queue.
However, I would like a way to determine at the time I write to the
queue whether the queue is full or not and take action at that point in
time.

One solution is to pass in a completionHandler when I call write on the
Connection. I can then keep track of the number of outstanding packets
(or bytes) outside the grizzly framework and on each write check if I
have exceeded my configured size and then take th appropriate action.

Can I get a brief explanation of how "maxAsyncWriteQueueSizeInBytes" is
intended to work and if I have missed anything that can give me what I
want within the grizzly framework.

Thank you,
Dave.