Package org.eclipse.jetty.io
Class LeakTrackingByteBufferPool
java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.component.ContainerLifeCycle
org.eclipse.jetty.io.LeakTrackingByteBufferPool
- All Implemented Interfaces:
ByteBufferPool
,Container
,Destroyable
,Dumpable
,Dumpable.DumpableContainer
,LifeCycle
@ManagedObject
public class LeakTrackingByteBufferPool
extends ContainerLifeCycle
implements ByteBufferPool
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener, AbstractLifeCycle.StopException
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.ByteBufferPool
ByteBufferPool.Lease
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Container
Container.InheritedListener, Container.Listener
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle
LifeCycle.Listener
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionacquire
(int size, boolean direct) Requests aByteBuffer
of the given size.Get this pool as aRetainableByteBufferPool
, which supports reference counting of the buffers and possibly a more efficient lookup mechanism based on thePool
class.void
Clears the tracking data returned bygetLeakedAcquires()
,getLeakedReleases()
,getLeakedResources()
.long
long
long
long
protected void
leaked
(LeakDetector<ByteBuffer>.LeakInfo leakInfo) void
release
(ByteBuffer buffer) Returns aByteBuffer
, usually obtained withByteBufferPool.acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse.void
remove
(ByteBuffer buffer) Removes aByteBuffer
that was previously obtained withByteBufferPool.acquire(int, boolean)
.Methods inherited from class org.eclipse.jetty.util.component.ContainerLifeCycle
addBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dumpObjects, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, start, stop, unmanage, updateBean, updateBean, updateBeans, updateBeans
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, setEventListeners, start, stop, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.ByteBufferPool
newByteBuffer
Methods inherited from interface org.eclipse.jetty.util.component.Container
getCachedBeans, getEventListeners
Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer
isDumpable
-
Constructor Details
-
LeakTrackingByteBufferPool
-
-
Method Details
-
asRetainableByteBufferPool
Description copied from interface:ByteBufferPool
Get this pool as aRetainableByteBufferPool
, which supports reference counting of the buffers and possibly a more efficient lookup mechanism based on thePool
class.- Specified by:
asRetainableByteBufferPool
in interfaceByteBufferPool
- Returns:
- This pool as a RetainableByteBufferPool. The same instance is always returned by multiple calls to this method.
-
acquire
Description copied from interface:ByteBufferPool
Requests a
ByteBuffer
of the given size.The returned buffer may have a bigger capacity than the size being requested.
- Specified by:
acquire
in interfaceByteBufferPool
- Parameters:
size
- the size of the bufferdirect
- whether the buffer must be direct or not- Returns:
- a buffer with at least the requested capacity, with position and limit set to 0.
- See Also:
-
release
Description copied from interface:ByteBufferPool
Returns a
ByteBuffer
, usually obtained withByteBufferPool.acquire(int, boolean)
(but not necessarily), making it available for recycling and reuse.- Specified by:
release
in interfaceByteBufferPool
- Parameters:
buffer
- the buffer to return- See Also:
-
remove
Description copied from interface:ByteBufferPool
Removes a
ByteBuffer
that was previously obtained withByteBufferPool.acquire(int, boolean)
.The buffer will not be available for further reuse.
- Specified by:
remove
in interfaceByteBufferPool
- Parameters:
buffer
- the buffer to remove- See Also:
-
clearTracking
Clears the tracking data returned bygetLeakedAcquires()
,getLeakedReleases()
,getLeakedResources()
. -
getLeakedAcquires
- Returns:
- count of ByteBufferPool.acquire() calls that detected a leak
-
getLeakedReleases
- Returns:
- count of ByteBufferPool.release() calls that detected a leak
-
getLeakedRemoves
- Returns:
- count of ByteBufferPool.remove() calls that detected a leak
-
getLeakedResources
- Returns:
- count of resources that were acquired but not released
-
leaked
-