public class PerformancePool
extends java.lang.Object
This class does not keep track of busy objects, it is up to the user of a borrowed object to return it to the pool.
To use this class, you supply the full name of an object to construct it and call getObject() to retrieve and object and returnObject to return it to the pool.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
Constructor and Description |
---|
PerformancePool(java.lang.String pClassName,
int pInitialSize)
Constructs a PerformancePool object and populates it with objects of a given type
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
createObject()
Constructs an object of a given type.
|
java.lang.Object |
getObject()
Returns an object from the pool to the caller.
|
boolean |
isEnabled()
Returns property enabled.
|
void |
returnObject(java.lang.Object pObject)
Returns an object back into the pool for later use.
|
void |
setEnabled(boolean pEnabled)
Sets property enabled.
|
boolean |
validateObjectType(java.lang.Object pObject)
Validates that an object is of a certain type.
|
public PerformancePool(java.lang.String pClassName, int pInitialSize) throws java.lang.ClassNotFoundException
pInitialSize
- the initial size of the pool.java.lang.ClassNotFoundException
public void setEnabled(boolean pEnabled)
public boolean isEnabled()
public java.lang.Object createObject() throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public boolean validateObjectType(java.lang.Object pObject)
pObject
- the object to validate the type ofpublic java.lang.Object getObject()
public void returnObject(java.lang.Object pObject)
pObject
- the object to return back to the pool