public abstract class PoolOfReusableResources
extends java.lang.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 java.lang.Object |
newResource()
Allocate a new resource
|
void |
release(java.lang.Object buffer) |
java.lang.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 allowedpublic java.lang.Object reserve()
public void release(java.lang.Object buffer)
protected abstract java.lang.Object newResource()