public abstract class CompressionPool<T> extends AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.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) |
addLifeCycleListener, doStart, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop, toString
public 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 AbstractLifeCycle
Copyright © 1995–2020 Webtide. All rights reserved.