Nope you don't need to call release twice to free it. >From basic analysis there seems to be a minor bug (may be) in the >implementation
Essentially, the release() function checks for refCount (Line 447) and checks for less than equal to 0. If the condition is true it throws an IllegalStateException. The default refCount is 1, so once you call acquire(), it becomes 2, first release makes it 1, now call second release(), condition at line 447 becomes false, so illegal state exception is not thrown as value of refCount is 1 :-), after that, refCount-- (Line 453) make it 0. So next time you call acquire(), it checks again for the refCount as if (refCount <= 0), and which come to be true, and exception is thrown :-) MINA Experts can comment more on my interpretation. In Sumary, you have to call release() as many times as you called acquire() Happy Coding :-) On Thu, Nov 6, 2008 at 11:54 AM, Rajeshwari M <[EMAIL PROTECTED]> wrote: > Hi All, > I've written small program to test bytebuffer acquire and release > } > > Does that means, we need to call release() two times to release the buffer > actually ??? > -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
