TrimmableHeapBuffer createTrimAwareBuffer(final byte[] heap, final int offset, final int length) { final TrimmableHeapBuffer buffer = ThreadCache.takeFromCache(CACHE_IDX); if (buffer != null) { buffer.initialize(this, heap, offset, length); return buffer; } return new TrimmableHeapBuffer(this, heap, offset, length); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void trim() { checkDispose(); final int sizeToReturn = cap - pos; if (sizeToReturn > 0) { final HeapBufferThreadLocalPool threadLocalCache = getHeapBufferThreadLocalPool(); if (threadLocalCache != null) { if (threadLocalCache.isLastAllocated(this)) { flip(); cap = lim; threadLocalCache.reduceLastAllocated(this); return; } else if (threadLocalCache.wantReset(sizeToReturn)) { flip(); cap = lim; threadLocalCache.reset(heap, offset + cap, sizeToReturn); return; } } } super.trim(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }
@Override public void dispose() { prepareDispose(); mm.release(this); mm = null; byteBuffer = null; heap = null; pos = 0; offset = 0; lim = 0; cap = 0; order = ByteOrder.BIG_ENDIAN; bigEndian = true; recycle(); }