mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: Byte Buffer release and acquire doubts
Date Thu, 06 Nov 2008 07:03:10 GMT
Rajeshwari M wrote:
> Hi All,
>   
Hi,

>           I've written small program to test bytebuffer acquire and release
> methods.
>
> Program:
>
> import org.apache.mina.common.ByteBuffer;
>
> public class ByteBufferTest {
>
>     public static void test() {
>         try{
>             ByteBuffer b = ByteBuffer.allocate(4000);
>             byte b1=1;
>             b.put(b1);
>             b.acquire();
>             b.release();
>             b.release(); // If I call release() method one more time. I get
> IlegalStateException in next line of acquire(). If I dont call release()
> second time. acquire() is not throwing any error.
>             b.acquire();
>
>         }catch(Exception e){
>             e.printStackTrace();
>         }
>
>     }
>
>     public static void main(String a[]){
>         test();
>     }
> }
>
> Does that means, we need to call release() two times to release the buffer
> actually ???
>   
Well, the best would be to look at the current code, and try to see if 
it's the case. Either you do it, or we do it, but the solution will be 
to look at the code anyway, and see if there is a bug or not :)


-- 
--
cordialement, regards,
Emmanuel L├ęcharny
www.iktek.com
directory.apache.org



Mime
View raw message