@ManagedObject public class LeakTrackingByteBufferPool extends ContainerLifeCycle implements ByteBufferPool
AbstractLifeCycle.AbstractLifeCycleListener
ByteBufferPool.Bucket, ByteBufferPool.Lease
Container.InheritedListener, Container.Listener
Dumpable.DumpableContainer
LifeCycle.Listener
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()
Clears the tracking data returned by
getLeakedAcquires() ,
getLeakedReleases() , getLeakedResources() . |
long |
getLeakedAcquires() |
long |
getLeakedReleases() |
long |
getLeakedRemoves() |
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. |
void |
remove(java.nio.ByteBuffer buffer)
Removes a
ByteBuffer that was previously obtained with ByteBufferPool.acquire(int, boolean) . |
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
isDumpable
dumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, named
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 remove(java.nio.ByteBuffer buffer)
ByteBufferPool
Removes a ByteBuffer
that was previously obtained with ByteBufferPool.acquire(int, boolean)
.
The buffer will not be available for further reuse.
remove
in interface ByteBufferPool
buffer
- the buffer to removeByteBufferPool.acquire(int, boolean)
,
ByteBufferPool.release(ByteBuffer)
@ManagedAttribute(value="Clears the tracking data") public void clearTracking()
getLeakedAcquires()
,
getLeakedReleases()
, getLeakedResources()
.@ManagedAttribute(value="The number of acquires that produced a leak") public long getLeakedAcquires()
@ManagedAttribute(value="The number of releases that produced a leak") public long getLeakedReleases()
@ManagedAttribute(value="The number of removes that produced a leak") public long getLeakedRemoves()
@ManagedAttribute(value="The number of resources that were leaked") public long getLeakedResources()
protected void leaked(LeakDetector.LeakInfo leakInfo)
Copyright © 1995–2021 Webtide. All rights reserved.