atg.service.perfmonitor
Class PerformancePool

java.lang.Object
  extended by atg.service.perfmonitor.PerformancePool

public class PerformancePool
extends java.lang.Object

This class manages pools of objects. In an effort to mimimize object creation during performance monitoring, this class precreates a pool of objects.

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.


Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
PerformancePool(java.lang.String pClassName, int pInitialSize)
          Constructs a PerformancePool object and populates it with objects of a given type
 
Method Summary
 java.lang.Object createObject()
          Constructs an object of a given type.
 java.lang.Object getObject()
          Returns an object from the pool to the caller.
 void returnObject(java.lang.Object pObject)
          Returns an object back into the pool for later use.
 boolean validateObjectType(java.lang.Object pObject)
          Validates that an object is of a certain type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

PerformancePool

public PerformancePool(java.lang.String pClassName,
                       int pInitialSize)
                throws java.lang.ClassNotFoundException
Constructs a PerformancePool object and populates it with objects of a given type

Parameters:
pInitialSize - the initial size of the pool.
Throws:
java.lang.ClassNotFoundException
Method Detail

createObject

public java.lang.Object createObject()
                              throws java.lang.InstantiationException,
                                     java.lang.IllegalAccessException
Constructs an object of a given type.

Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

validateObjectType

public boolean validateObjectType(java.lang.Object pObject)
Validates that an object is of a certain type.

Parameters:
pObject - the object to validate the type of

getObject

public java.lang.Object getObject()
Returns an object from the pool to the caller. This call does not keep track of the borrowed objects.


returnObject

public void returnObject(java.lang.Object pObject)
Returns an object back into the pool for later use.

Parameters:
pObject - the object to return back to the pool