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, org.eclipse.jetty.util.component.Container, org.eclipse.jetty.util.component.Destroyable, org.eclipse.jetty.util.component.Dumpable, org.eclipse.jetty.util.component.Dumpable.DumpableContainer, org.eclipse.jetty.util.component.LifeCycle

@ManagedObject public class LeakTrackingByteBufferPool extends org.eclipse.jetty.util.component.ContainerLifeCycle implements ByteBufferPool
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener, org.eclipse.jetty.util.component.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

    org.eclipse.jetty.util.component.Container.InheritedListener, org.eclipse.jetty.util.component.Container.Listener

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable

    org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle

    org.eclipse.jetty.util.component.LifeCycle.Listener
  • Field Summary

    Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle

    FAILED, STARTED, STARTING, STOPPED, STOPPING

    Fields inherited from interface org.eclipse.jetty.io.ByteBufferPool

    NOOP

    Fields inherited from interface org.eclipse.jetty.util.component.Dumpable

    KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    acquire(int size, boolean direct)
    Requests a ByteBuffer of the given size.
    Get this pool as a RetainableByteBufferPool, which supports reference counting of the buffers and possibly a more efficient lookup mechanism based on the Pool class.
    void
    Clears the tracking data returned by getLeakedAcquires(), getLeakedReleases(), getLeakedResources().
    long
     
    long
     
    long
     
    long
     
    protected void
    leaked(org.eclipse.jetty.util.LeakDetector<ByteBuffer>.org.eclipse.jetty.util.LeakDetector.LeakInfo leakInfo)
     
    void
    Returns a ByteBuffer, usually obtained with ByteBufferPool.acquire(int, boolean) (but not necessarily), making it available for recycling and reuse.
    void
    Removes a ByteBuffer that was previously obtained with ByteBufferPool.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

    dumpSelf

    Methods inherited from interface org.eclipse.jetty.util.component.Dumpable.DumpableContainer

    isDumpable
  • Constructor Details

    • LeakTrackingByteBufferPool

      public LeakTrackingByteBufferPool(ByteBufferPool delegate)
  • Method Details

    • asRetainableByteBufferPool

      public RetainableByteBufferPool asRetainableByteBufferPool()
      Description copied from interface: ByteBufferPool
      Get this pool as a RetainableByteBufferPool, which supports reference counting of the buffers and possibly a more efficient lookup mechanism based on the Pool class.
      Specified by:
      asRetainableByteBufferPool in interface ByteBufferPool
      Returns:
      This pool as a RetainableByteBufferPool. The same instance is always returned by multiple calls to this method.
    • acquire

      public ByteBuffer acquire(int size, boolean direct)
      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 interface ByteBufferPool
      Parameters:
      size - the size of the buffer
      direct - 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

      public void release(ByteBuffer buffer)
      Description copied from interface: ByteBufferPool

      Returns a ByteBuffer, usually obtained with ByteBufferPool.acquire(int, boolean) (but not necessarily), making it available for recycling and reuse.

      Specified by:
      release in interface ByteBufferPool
      Parameters:
      buffer - the buffer to return
      See Also:
    • remove

      public void remove(ByteBuffer buffer)
      Description copied from interface: ByteBufferPool

      Removes a ByteBuffer that was previously obtained with ByteBufferPool.acquire(int, boolean).

      The buffer will not be available for further reuse.

      Specified by:
      remove in interface ByteBufferPool
      Parameters:
      buffer - the buffer to remove
      See Also:
    • clearTracking

      @ManagedAttribute("Clears the tracking data") public void clearTracking()
      Clears the tracking data returned by getLeakedAcquires(), getLeakedReleases(), getLeakedResources().
    • getLeakedAcquires

      @ManagedAttribute("The number of acquires that produced a leak") public long getLeakedAcquires()
      Returns:
      count of ByteBufferPool.acquire() calls that detected a leak
    • getLeakedReleases

      @ManagedAttribute("The number of releases that produced a leak") public long getLeakedReleases()
      Returns:
      count of ByteBufferPool.release() calls that detected a leak
    • getLeakedRemoves

      @ManagedAttribute("The number of removes that produced a leak") public long getLeakedRemoves()
      Returns:
      count of ByteBufferPool.remove() calls that detected a leak
    • getLeakedResources

      @ManagedAttribute("The number of resources that were leaked") public long getLeakedResources()
      Returns:
      count of resources that were acquired but not released
    • leaked

      protected void leaked(org.eclipse.jetty.util.LeakDetector<ByteBuffer>.org.eclipse.jetty.util.LeakDetector.LeakInfo leakInfo)