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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CompressionPool.Entry
-
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.util.component.LifeCycle
LifeCycle.Listener
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CAPACITY
-
Constructor Summary
Constructors Constructor Description CompressionPool(int capacity)
Create a Pool ofCompressionPool
instances.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompressionPool.Entry
acquire()
protected void
doStart()
Method to override to start the lifecyclevoid
doStop()
Method to override to stop the lifecycleprotected abstract void
end(T object)
int
getCapacity()
protected abstract T
newPooled()
void
release(CompressionPool.Entry entry)
protected abstract void
reset(T object)
void
setCapacity(int capacity)
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addEventListener, getEventListeners, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeEventListener, setEventListeners, start, stop
-
-
-
-
Field Detail
-
DEFAULT_CAPACITY
public static final int DEFAULT_CAPACITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompressionPool
public CompressionPool(int capacity)
Create a Pool ofCompressionPool
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 Detail
-
getCapacity
public int getCapacity()
-
setCapacity
public void setCapacity(int capacity)
-
newPooled
protected abstract T newPooled()
-
end
protected abstract void end(T object)
-
reset
protected abstract void reset(T object)
-
acquire
public CompressionPool.Entry acquire()
- Returns:
- Object taken from the pool if it is not empty or a newly created Object
-
release
public void release(CompressionPool.Entry entry)
- Parameters:
entry
- returns this Object to the pool or callsend(Object)
if the pool is full.
-
doStart
protected void doStart() throws java.lang.Exception
Description copied from class:AbstractLifeCycle
Method to override to start the lifecycle- Overrides:
doStart
in classAbstractLifeCycle
- Throws:
AbstractLifeCycle.StopException
- If thrown, the lifecycle will immediately be stopped.java.lang.Exception
- If there was a problem starting. Will cause a transition to FAILED state
-
doStop
public void doStop() throws java.lang.Exception
Description copied from class:AbstractLifeCycle
Method to override to stop the lifecycle- Overrides:
doStop
in classAbstractLifeCycle
- Throws:
java.lang.Exception
- If there was a problem stopping. Will cause a transition to FAILED state
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractLifeCycle
-
-