com.cafesoft.core.pool
Class StandardLiteObjectPool

java.lang.Object
  |
  +--com.cafesoft.core.pool.StandardLiteObjectPool
All Implemented Interfaces:
Destroyable, LiteObjectPool

public class StandardLiteObjectPool
extends Object
implements LiteObjectPool

Standard implementation of the LiteObjectPool interface.

Since:
11/12/03
See Also:
LiteObjectPool

Field Summary
 
Fields inherited from interface com.cafesoft.core.pool.LiteObjectPool
OBJECT_STATUS_ACTIVE, OBJECT_STATUS_IDLE, OBJECT_STATUS_UNKNOWN
 
Constructor Summary
StandardLiteObjectPool()
          Create a new StandardLiteObjectPool.
StandardLiteObjectPool(ObjectPoolConfig config)
          Create a new StandardLiteObjectPool.
StandardLiteObjectPool(ObjectPoolConfig config, boolean destroyObjects)
          Create a new StandardLiteObjectPool.
 
Method Summary
 void addObject(Object object, int objectStatus)
          Add an Object to the ObjectPool.
 Object borrowObject()
          Borrow an Object from the ObjectPool.
 void destroy()
          Destroy the object and it's resources.
 ObjectPoolConfig getConfig()
          Get the pool's configuration object.
 void removeObject(Object object)
          Remove an Object from the ObjectPool.
 void returnObject(Object object)
          Return an Object to the ObjectPool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardLiteObjectPool

public StandardLiteObjectPool()
Create a new StandardLiteObjectPool.


StandardLiteObjectPool

public StandardLiteObjectPool(ObjectPoolConfig config)
Create a new StandardLiteObjectPool.

Parameters:
config - the ObjectPool's configuration object.

StandardLiteObjectPool

public StandardLiteObjectPool(ObjectPoolConfig config,
                              boolean destroyObjects)
Create a new StandardLiteObjectPool.

Parameters:
config - the ObjectPool's configuration object.
destroyObjects - a boolean that informs the ObjectPool to destroy the objects.
Method Detail

getConfig

public ObjectPoolConfig getConfig()
Get the pool's configuration object.

Specified by:
getConfig in interface LiteObjectPool
Returns:
the LiteObjectPool's configuration object.

addObject

public void addObject(Object object,
                      int objectStatus)
               throws ObjectPoolException
Add an Object to the ObjectPool.

Specified by:
addObject in interface LiteObjectPool
Parameters:
object - the Object to add to the ObjectPool.
objectStatus - the status of the Object being added to the ObjectPool. This value informs the ObjectPool of the Object current usage.
Throws:
ObjectPoolException - if any error occurs adding the Object to the ObjectPool.

removeObject

public void removeObject(Object object)
Remove an Object from the ObjectPool.

Specified by:
removeObject in interface LiteObjectPool
Parameters:
object - the Object to remove from the ObjectPool.

borrowObject

public Object borrowObject()
                    throws ObjectPoolException
Borrow an Object from the ObjectPool.

Specified by:
borrowObject in interface LiteObjectPool
Returns:
an Object from the ObjectPool.
Throws:
ObjectPoolException - if any error occurs borrowing an Object from the ObjectPool.

returnObject

public void returnObject(Object object)
Return an Object to the ObjectPool.

Specified by:
returnObject in interface LiteObjectPool
Parameters:
object - the Object to return to the ObjectPool.

destroy

public void destroy()
Destroy the object and it's resources.

This method when called should free all resources used by this object. In addition, it should render the object unusable. Therefore, this method should only be called once per object.

Specified by:
destroy in interface Destroyable


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.