@Override
    public ByteBuffer getByteBuffer() {
        // Poll the oldest buffer ref
        SoftReference<ByteBuffer> byteBufferRef = pool.poll();

        // Tmp
        ByteBuffer buffer;

        if (byteBufferRef == null || (buffer = byteBufferRef.get()) == null) {
            // Allocate a new byte buffer
            buffer =
                    direct ? ByteBuffer.allocateDirect(initialCapacity)
                    : ByteBuffer.allocate(initialCapacity);
        } else {
            // Clear the old buffer
            buffer.clear();
        }

        return buffer;
    }