/** * Allocate a {@link ByteBuffer} if the current instance is null; */ protected void createByteBuffer(boolean force){ if (force || byteBuffer == null){ byteBuffer = ByteBufferFactory.allocate(byteBufferType, initialByteBufferSize); } }
/** * Allocate a {@link ByteBuffer} if the current instance is null; */ protected void createByteBuffer(boolean force){ if (force || byteBuffer == null){ byteBuffer = ByteBufferFactory.allocate(byteBufferType, initialByteBufferSize); } }
public void run(){ if (byteBuffer == null){ byteBuffer = ByteBufferFactory.allocate(byteBufferType, initialByteBufferSize);
public ThreadAttachment detach() { ThreadAttachment currentAttachment = getAttachment(); int mode = currentAttachment.getMode(); updateAttachment(mode); // Re-create a new ByteBuffer if ((mode & Mode.BYTE_BUFFER) != 0) { byteBuffer = ByteBufferFactory.allocate(byteBufferType, initialByteBufferSize); } if ((mode & Mode.SSL_ENGINE) != 0) { sslEngine = null; } if ((mode & Mode.INPUT_BB) != 0) { inputBB = null; } if ((mode & Mode.OUTPUT_BB) != 0) { outputBB = null; } // Switch to the new ThreadAttachment. this.threadAttachment = null; currentAttachment.deassociate(); return currentAttachment; }