Class CompressionPool<T>

java.lang.Object
org.eclipse.jetty.util.component.AbstractLifeCycle
org.eclipse.jetty.util.compression.CompressionPool<T>
All Implemented Interfaces:
LifeCycle
Direct Known Subclasses:
DeflaterPool, InflaterPool

public abstract class CompressionPool<T> extends AbstractLifeCycle
  • Field Details

    • INFINITE_CAPACITY

      public static final int INFINITE_CAPACITY
      See Also:
    • _pool

      private final Queue<T> _pool
    • _numObjects

      private final AtomicInteger _numObjects
    • _capacity

      private final int _capacity
  • Constructor Details

    • CompressionPool

      public CompressionPool(int capacity)
      Create a Pool of CompressionPool instances. If given a capacity equal to zero the Objects will not be pooled and will be created on acquire and ended on release. If given a negative capacity equal to zero there will be no size restrictions on the Pool
      Parameters:
      capacity - maximum number of Objects which can be contained in the pool
  • Method Details

    • newObject

      protected abstract T newObject()
    • end

      protected abstract void end(T object)
    • reset

      protected abstract void reset(T object)
    • acquire

      public T acquire()
      Returns:
      Object taken from the pool if it is not empty or a newly created Object
    • release

      public void release(T object)
      Parameters:
      object - returns this Object to the pool or calls end(Object) if the pool is full.
    • doStop

      public void doStop()
      Overrides:
      doStop in class AbstractLifeCycle
    • toString

      public String toString()
      Overrides:
      toString in class AbstractLifeCycle