Class CompressionPool<T>

All Implemented Interfaces:
Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle
Direct Known Subclasses:
DeflaterPool, InflaterPool

@ManagedObject public abstract class CompressionPool<T> extends ContainerLifeCycle
  • Field Details

  • 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

    • getCapacity

      public int getCapacity()
    • setCapacity

      public void setCapacity(int capacity)
    • getPool

      public Pool<CompressionPool<T>.Entry> getPool()
    • newPooled

      protected abstract T newPooled()
    • end

      protected abstract void end(T object)
    • reset

      protected abstract void reset(T object)
    • acquire

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

      public void release(CompressionPool<T>.Entry entry)
      Parameters:
      entry - returns this Object to the pool or calls end(Object) if the pool is full.
    • doStart

      protected void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      Overrides:
      doStart in class ContainerLifeCycle
      Throws:
      AbstractLifeCycle.StopException - If thrown, the lifecycle will immediately be stopped.
      Exception - If there was a problem starting. Will cause a transition to FAILED state
    • doStop

      public void doStop() throws Exception
      Description copied from class: ContainerLifeCycle
      Stops the managed lifecycle beans in the reverse order they were added.
      Overrides:
      doStop in class ContainerLifeCycle
      Throws:
      Exception - If there was a problem stopping. Will cause a transition to FAILED state
    • toString

      public String toString()
      Overrides:
      toString in class AbstractLifeCycle