|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ObjectPoolManager
This acts as a factory for object pools. An administrator can create one or more ObjectPoolManagers and bind them in to JNDI using wsadmin or the administrative console. The ObjectPoolManager screen can be found in the administrative console by clicking on Resources and then ObjectPools.
The Administrator can define one or more ObjectPoolManagers here. Such an ObjectPoolManager can be used by an application to act as a factory for creating or reusing an already created object pool for a specific Java type. Any Java object that has a public default constructor can be pooled out of the box using the default implementation.
If your application needs to pool an object that doesn't meet that criteria or if your application wants to be informed when objects are taken and returned from/to the object pool then the administrator can define a custom ObjectPool. When the administrator creates an ObjectPoolManager then the administrator can also define zero or more custom Object pools also. A custom object pool is a non sychronized object that implements the CustomObjectPool interface. Each custom pool must be registered using the admin and the class name of the type to be pooled, the class implementing the CustomObjectPool and any custom properties must be specified. If an application then uses this ObjectPoolManager and requests a pool for this type then an instance of the CustomObjectPool is used to implement that pool.
If an object that is a Java 2 Collection is pooled then such objects are automatically cleared when they are returned to the pool by an application. This behaviour is implemented by the default pool handler. If a custom object pool is provided then the implemented should copy this behaviour.
Applications that need an object pool should include a resource-ref to an ObjectPoolManager in their J2EE component (EJB or webapp). The application containing that component can then be bound to a administrator created ObjectPoolManager at deploy time. The J2EE component can then retrieve this ObjectPoolManager using the following code:
InitialContext ic = new InitialContext(); ObjectPoolManager opm = (ObjectPoolManager)ic.lookup("java:comp/env/opm/myObjectPoolManager");
If you are sharing an object pool between applications that care needs to be taken to avoid class loader problems. This isn't an issue when pooling JDK supplied objects but if you are pooling application objects then it may occur. We recommend that pools not be shared between applications when application objects are being pooled.
Every ObjectPool also has a JMX MBean associated with it. The MBean can be used to flush idle instances of the object being pooled.
ObjectPool
,
CustomObjectPool
Method Summary | |
---|---|
ObjectPool |
createFastPool(java.lang.Class aClass)
This returns a pool for managing instances of a class. |
ObjectPool |
getPool(java.lang.Class aClass)
This returns a pool for managing instances of a class. |
Method Detail |
---|
ObjectPool getPool(java.lang.Class aClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
ObjectPools for Java 2 collection based classes are automatically cleared when returned to the pool.
java.lang.InstantiationException
java.lang.IllegalAccessException
ObjectPool createFastPool(java.lang.Class aClass) throws java.lang.InstantiationException, java.lang.IllegalAccessException
ObjectPools for Java 2 collection based classes are automatically cleared when returned to the pool.
java.lang.InstantiationException
java.lang.IllegalAccessException
|
IBM WebSphere Application ServerTM Release 8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |