Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.util
Class ObjectPoolManager  view ObjectPoolManager download ObjectPoolManager.java

java.lang.Object
  extended byorg.scopemvc.util.ObjectPoolManager

public class ObjectPoolManager
extends java.lang.Object

Manages pooling of instances of different classes.

Version:
$Revision: 1.3 $ $Date: 2002/01/26 09:46:20 $

Field Summary
private static ObjectPoolManager INSTANCE
          The singleton instance of this class
private static org.apache.commons.logging.Log LOG
           
private  java.util.Map poolByClass
          Object pools keyed by class
 
Constructor Summary
private ObjectPoolManager()
          Constructor.
 
Method Summary
 void addObjectPool(java.lang.Class clazz, ObjectPool pool)
          Adds a pool to be managed.
 java.lang.Object borrowObject(java.lang.Class clazz)
          Obtains an instance of the sepcified class from the pool.
 java.lang.Object borrowObjectIfExists(java.lang.Class clazz)
          Obtains an instance of the specified class from the pool.
static ObjectPoolManager getInstance()
          Obtains the singleton instance of this class.
 ObjectPool getObjectPool(java.lang.Class clazz)
          Obtains the pool for the given class
 void returnObject(java.lang.Object object)
          Returns an instance to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

INSTANCE

private static final ObjectPoolManager INSTANCE
The singleton instance of this class


poolByClass

private final java.util.Map poolByClass
Object pools keyed by class

Constructor Detail

ObjectPoolManager

private ObjectPoolManager()
Constructor.

Method Detail

getInstance

public static ObjectPoolManager getInstance()
Obtains the singleton instance of this class.


borrowObject

public final java.lang.Object borrowObject(java.lang.Class clazz)
Obtains an instance of the sepcified class from the pool. Blocks if no free instances.


borrowObjectIfExists

public final java.lang.Object borrowObjectIfExists(java.lang.Class clazz)
Obtains an instance of the specified class from the pool. Returns null if no free instances.


returnObject

public final void returnObject(java.lang.Object object)
Returns an instance to the pool.


getObjectPool

public final ObjectPool getObjectPool(java.lang.Class clazz)
Obtains the pool for the given class


addObjectPool

public final void addObjectPool(java.lang.Class clazz,
                                ObjectPool pool)
Adds a pool to be managed.