slumberdb/slumberdb-service-model/src/main/java/org/boon/slumberdb/stores/log/CollectorManager.java
public final ByteBuffer allocateBuffer(int size) {

        if (RECYCLE_BUFFER) {
            ByteBuffer spentBuffer = recycleChannel.poll();
            if (spentBuffer == null) {
                spentBuffer = ByteBuffer.allocateDirect(size);
            }
            spentBuffer.clear();
            return spentBuffer;
        } else {
            return ByteBuffer.allocateDirect(size);
        }
    }
public final ByteBuffer allocateBuffer(int size) {

        if (RECYCLE_BUFFER) {
            ByteBuffer spentBuffer = recycleChannel.poll();
            if (spentBuffer == null) {
                spentBuffer = ByteBuffer.allocateDirect(size);
            }
            spentBuffer.clear();
            return spentBuffer;
        } else {
            return ByteBuffer.allocateDirect(size);
        }
    }
public final ByteBuffer allocateBuffer ( int size ) { if ( RECYCLE_BUFFER ) { ByteBuffer spentBuffer = recycleChannel . poll ( ) ; if ( spentBuffer == null ) { spentBuffer = ByteBuffer . allocateDirect ( size ) ; } spentBuffer . clear ( ) ; return spentBuffer ; } else { return ByteBuffer . allocateDirect ( size ) ; } }
This gets called from the http post handler  or event bus handler.

@param size the size of the buffer that you would like.
@return
This gets called from the http post handler or event bus handler .