public class LeakTrackingByteBufferPool extends ContainerLifeCycle implements ByteBufferPool
AbstractLifeCycle.AbstractLifeCycleListener
ByteBufferPool.Bucket, ByteBufferPool.Lease
Container.InheritedListener, Container.Listener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
private ByteBufferPool |
delegate |
private LeakDetector<java.nio.ByteBuffer> |
leakDetector |
private java.util.concurrent.atomic.AtomicLong |
leaked |
private java.util.concurrent.atomic.AtomicLong |
leakedAcquires |
private java.util.concurrent.atomic.AtomicLong |
leakedReleases |
private static Logger |
LOG |
private static boolean |
NOISY |
Constructor and Description |
---|
LeakTrackingByteBufferPool(ByteBufferPool delegate) |
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
acquire(int size,
boolean direct)
Requests a
ByteBuffer of the given size. |
void |
clearTracking() |
long |
getLeakedAcquires() |
long |
getLeakedReleases() |
long |
getLeakedResources() |
protected void |
leaked(LeakDetector.LeakInfo leakInfo) |
void |
release(java.nio.ByteBuffer buffer)
Returns a
ByteBuffer , usually obtained with ByteBufferPool.acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse. |
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
newByteBuffer
dumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, named
private static final Logger LOG
private final LeakDetector<java.nio.ByteBuffer> leakDetector
private static final boolean NOISY
private final ByteBufferPool delegate
private final java.util.concurrent.atomic.AtomicLong leakedReleases
private final java.util.concurrent.atomic.AtomicLong leakedAcquires
private final java.util.concurrent.atomic.AtomicLong leaked
public LeakTrackingByteBufferPool(ByteBufferPool delegate)
public java.nio.ByteBuffer acquire(int size, boolean direct)
ByteBufferPool
Requests a ByteBuffer
of the given size.
The returned buffer may have a bigger capacity than the size being requested but it will have the limit set to the given size.
acquire
in interface ByteBufferPool
size
- the size of the bufferdirect
- whether the buffer must be direct or notByteBufferPool.release(ByteBuffer)
public void release(java.nio.ByteBuffer buffer)
ByteBufferPool
Returns a ByteBuffer
, usually obtained with ByteBufferPool.acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse.
release
in interface ByteBufferPool
buffer
- the buffer to returnByteBufferPool.acquire(int, boolean)
public void clearTracking()
public long getLeakedAcquires()
public long getLeakedReleases()
public long getLeakedResources()
protected void leaked(LeakDetector.LeakInfo leakInfo)