|
|||||||||
| Home >> All >> org >> scopemvc >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scopemvc.util
Class BasicObjectPool

java.lang.Objectorg.scopemvc.util.BasicObjectPool
- All Implemented Interfaces:
- ObjectPool
- public class BasicObjectPool
- extends java.lang.Object
- implements ObjectPool
- extends java.lang.Object
Pools objects given a factory and optional maximum pool size.
- Version:
- $Revision: 1.3 $
| Field Summary | |
private PoolableObjectFactory |
factory
The factory used to create pooled objects |
private java.util.LinkedList |
freeList
Queue of free instances |
private java.lang.Object |
lock
Used for synchronisation |
private static org.apache.commons.logging.Log |
LOG
|
private int |
maxSize
The maximum number of objects to pool |
| Constructor Summary | |
BasicObjectPool(PoolableObjectFactory inFactory)
Construct a basic object pool with the specified factory and a maximum pool size of Integer.MAX_VALUE. |
|
BasicObjectPool(PoolableObjectFactory inFactory,
int inMaxSize)
Construct a basic object pool with the specified factory and maximum pool size. |
|
| Method Summary | |
java.lang.Object |
borrowObject()
Obtains an instance of the pooled class. |
java.lang.Object |
borrowObjectIfExists()
Obtains an instance of the pooled 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
lock
private final java.lang.Object lock
- Used for synchronisation
freeList
private final java.util.LinkedList freeList
- Queue of free instances
factory
private final PoolableObjectFactory factory
- The factory used to create pooled objects
maxSize
private final int maxSize
- The maximum number of objects to pool
| Constructor Detail |
BasicObjectPool
public BasicObjectPool(PoolableObjectFactory inFactory)
- Construct a basic object pool with the specified factory and a maximum
pool size of Integer.MAX_VALUE.
BasicObjectPool
public BasicObjectPool(PoolableObjectFactory inFactory, int inMaxSize)
- Construct a basic object pool with the specified factory and maximum
pool size.
| Method Detail |
borrowObject
public java.lang.Object borrowObject()
- Obtains an instance of the pooled class. Blocks if no free instances.
- Specified by:
borrowObjectin interfaceObjectPool
borrowObjectIfExists
public java.lang.Object borrowObjectIfExists()
- Obtains an instance of the pooled class. Returns null if no free
instances.
- Specified by:
borrowObjectIfExistsin interfaceObjectPool
returnObject
public void returnObject(java.lang.Object object)
- Returns an instance to the pool.
- Specified by:
returnObjectin interfaceObjectPool
|
|||||||||
| Home >> All >> org >> scopemvc >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.scopemvc.util.BasicObjectPool