private CharBufferThreadLocalPool getCharBufferThreadLocalPool() { CharBufferThreadLocalPool pool = charBufferPools.get(); if (pool == null) { pool = new CharBufferThreadLocalPool(); charBufferPools.set(pool); } return pool; }
public CharBuffer allocate(int size) { if (remaining() < size) { pool = new char[MAX_BUFFER_SIZE]; pos = 0; } CharBuffer allocated = new CharBuffer(pool, pos, size); pos += size; return allocated; }
private void releaseCharBuffer() { if (buf == null) return; if ((buf.lim - buf.offset) <= MAX_BUFFER_SIZE) { getCharBufferThreadLocalPool().release(buf); } buf = null; }
private void allocateCharBuffer() { if (bufferSize == 0) return; if (bufferSize > MAX_BUFFER_SIZE) { buf = new CharBuffer(new char[bufferSize], 0, bufferSize); } else { buf = getCharBufferThreadLocalPool().allocate(bufferSize); } }
private void releaseCharBuffer() { if (buf == null) return; if ((buf.lim - buf.offset) <= MAX_BUFFER_SIZE) { getCharBufferThreadLocalPool().release(buf); } buf = null; }
private void releaseCharBuffer() { if (buf == null) return; if ((buf.lim - buf.offset) <= MAX_BUFFER_SIZE) { getCharBufferThreadLocalPool().release(buf); } buf = null; }
private void allocateCharBuffer() { if (bufferSize == 0) return; if (bufferSize > MAX_BUFFER_SIZE) { buf = new CharBuffer(new char[bufferSize], 0, bufferSize); } else { buf = getCharBufferThreadLocalPool().allocate(bufferSize); } }
public CharBuffer allocate(int size) { if (remaining() < size) { pool = new char[MAX_BUFFER_SIZE]; pos = 0; } CharBuffer allocated = new CharBuffer(pool, pos, size); pos += size; return allocated; }
public CharBuffer allocate(int size) { if (remaining() < size) { pool = new char[MAX_BUFFER_SIZE]; pos = 0; } CharBuffer allocated = new CharBuffer(pool, pos, size); pos += size; return allocated; }
private void allocateCharBuffer() { if (bufferSize == 0) return; if (bufferSize > MAX_BUFFER_SIZE) { buf = new CharBuffer(new char[bufferSize], 0, bufferSize); } else { buf = getCharBufferThreadLocalPool().allocate(bufferSize); } }
private CharBufferThreadLocalPool getCharBufferThreadLocalPool() { CharBufferThreadLocalPool pool = charBufferPools.get(); if (pool == null) { pool = new CharBufferThreadLocalPool(); charBufferPools.set(pool); } return pool; }
private CharBufferThreadLocalPool getCharBufferThreadLocalPool() { CharBufferThreadLocalPool pool = charBufferPools.get(); if (pool == null) { pool = new CharBufferThreadLocalPool(); charBufferPools.set(pool); } return pool; }