dev@grizzly.java.net

About disposing a Buffer in Grizzly v2

From: Bongjae Chang <bongjae.chang_at_gmail.com>
Date: Wed, 23 Nov 2011 17:25:09 +0900

Hi,

I have some questions while I am reviewing some codes and samples for
supporting grizzly-thrift. :-)

I know a Buffer can be allocated by MemoryManager and the buffer will be
disposed by writer if I set the buffer to be true with allowBufferDispose()
method.

When I reviewed XXXNIOTransportFilter and XXXNIOTransport, the read buffer
would be allocated but I couldn't find the point where the buffer was
disposed.

1. When will the allocated buffer be disposed? Should the user's filter or
Transformer release it if the buffer will be useless any more?

2. BufferOutputStream's currentBuffer can be allocated in
BufferOutputStream#ensureCapacity() and the currentBuffer will has also
allowBufferDispose flag as false. At first I thought the buffer would be
released in BufferOutputStream#close(). But BufferOutputStream#close() is
empty method. Perhaps is it intended?

Thanks in advance.

Regards,
Bongjae Chang