org.scopemvc.util
Class BasicObjectPool

java.lang.Object
  |
  +--org.scopemvc.util.BasicObjectPool
All Implemented Interfaces:
ObjectPool

public class BasicObjectPool
extends java.lang.Object
implements ObjectPool

Pools objects given a factory and optional maximum pool size.

Version:
$Revision: 1.5 $
Author:
Simon Harris

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
 

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.

Parameters:
inFactory - TODO: Describe the Parameter

BasicObjectPool

public BasicObjectPool(PoolableObjectFactory inFactory,
                       int inMaxSize)
Construct a basic object pool with the specified factory and maximum pool size.

Parameters:
inFactory - TODO: Describe the Parameter
inMaxSize - TODO: Describe the Parameter
Method Detail

borrowObject

public java.lang.Object borrowObject()
Obtains an instance of the pooled class. Blocks if no free instances.

Specified by:
borrowObject in interface ObjectPool
Returns:
TODO: Describe the Return Value

borrowObjectIfExists

public java.lang.Object borrowObjectIfExists()
Obtains an instance of the pooled class. Returns null if no free instances.

Specified by:
borrowObjectIfExists in interface ObjectPool
Returns:
TODO: Describe the Return Value

returnObject

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

Specified by:
returnObject in interface ObjectPool
Parameters:
object - A previously borrowed instance.


Copyright © 2000-2002 The Scope Team. All Rights Reserved.