users@grizzly.java.net

exception using ByteBufferManager

From: Jon Brisbin <jon_at_jbrisbin.com>
Date: Wed, 27 Jul 2011 15:58:10 -0500 (CDT)

I'm trying to use the ByteBufferManager in my application because I'm hitting some issues with garbage collecting all these byte arrays I'm allocating for writing uploads. Whenever I try and allocate an object from it, though, I get this exception:

java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to org.glassfish.grizzly.memory.HeapBuffer
at org.glassfish.grizzly.memory.HeapMemoryManager$HeapBufferThreadLocalPool.reset(HeapMemoryManager.java:307)
at org.glassfish.grizzly.memory.ByteBufferManager.reallocatePoolBuffer(ByteBufferManager.java:371)
at org.glassfish.grizzly.memory.ByteBufferManager.allocateByteBuffer(ByteBufferManager.java:238)
at org.glassfish.grizzly.memory.ByteBufferAware$allocateByteBuffer.call(Unknown Source)

Are there example of proper use of this somewhere?

Thanks!

Jon Brisbin
http//jbrisbin.com