public abstract class CompressionPool<T> extends AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
static int |
INFINITE_CAPACITY |
| Constructor and Description |
|---|
CompressionPool(int capacity)
Create a Pool of
T instances. |
| Modifier and Type | Method and Description |
|---|---|
T |
acquire() |
void |
doStop() |
protected abstract void |
end(T object) |
protected abstract T |
newObject() |
void |
release(T object) |
protected abstract void |
reset(T object) |
java.lang.String |
toString() |
addLifeCycleListener, doStart, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stoppublic static final int INFINITE_CAPACITY
public CompressionPool(int capacity)
T 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 Poolcapacity - maximum number of Objects which can be contained in the poolprotected abstract T newObject()
protected abstract void end(T object)
protected abstract void reset(T object)
public T acquire()
public void release(T object)
object - returns this Object to the pool or calls end(Object) if the pool is full.public void doStop()
doStop in class AbstractLifeCyclepublic java.lang.String toString()
toString in class AbstractLifeCycleCopyright © 1995–2021 Webtide. All rights reserved.