Package rma.util
Class ObjectPool
java.lang.Object
rma.util.ObjectPool
class to hold a pool of objects. If the pool is empty
then new objects are created. As objects are returned
to the pool only _minSize objects are kept around.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Object
int
get the max size of the poolget the next available object.int
get the number of outstanding objectsvoid
returnObject
(Object obj) return an object.void
setMaxSize
(int max) set the max size of the poolint
size()
return the min size of the pool
-
Constructor Details
-
ObjectPool
public ObjectPool(int minSize) -
ObjectPool
public ObjectPool(int minSize, int maxSize)
-
-
Method Details
-
buildObject
-
getObject
get the next available object. if the pool is empty, get a new object. if the max number of objects outstanding is reached, wait for an object to be returned -
returnObject
return an object. If the pool is full the object not returned to the pool -
size
public int size()return the min size of the pool -
setMaxSize
public void setMaxSize(int max) set the max size of the pool -
getMaxSize
public int getMaxSize()get the max size of the pool -
getObjectOut
public int getObjectOut()get the number of outstanding objects
-