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 ???