public abstract class PoolOfReusableResources extends Object
reserve()
and released using
release(Object)
. Pool may have a maximum number of resources.Constructor and Description |
---|
PoolOfReusableResources(int maxNbResources)
Allocate a new pool of resources
|
Modifier and Type | Method and Description |
---|---|
protected abstract Object |
newResource()
Allocate a new resource
|
void |
release(Object buffer) |
Object |
reserve()
Reserve a buffer.
|
public PoolOfReusableResources(int maxNbResources)
maxNbResources
- a strictly positive integer giving the maximum number of allocated resources, or 0 if an unlimited
number of resources is allowedprotected abstract Object newResource()
public void release(Object buffer)
public Object reserve()