mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajeshwari M" <raji...@gmail.com>
Subject Byte Buffer release and acquire doubts
Date Thu, 06 Nov 2008 06:24:13 GMT
Hi All,
          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 ???

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message