com.cafesoft.core.pool
Interface PoolableObjectFactory

All Known Implementing Classes:
DefaultPoolableObjectFactory

public interface PoolableObjectFactory

The PoolableObjectFactory is designed to manage the creation, validation, and destruction of objects that are stored in the ObjectPool.

Having this object handle object maintenance reduces the load the ObjectPool must handle. In addition, it allows for the implementing class to handle the particulars that each object it creates has.

Since:
10/19/01

Method Summary
 Object createObject()
          Create a new object for the ObjectPool
 void destroyObject(Object object)
          Destroy an object that can no longer needed by the ObjectPool.
 boolean validateObject(Object object)
          Ensures that the Object is safe to be returned by the pool.
 

Method Detail

createObject

public Object createObject()
                    throws Exception
Create a new object for the ObjectPool

Returns:
A newly create object for insertion into the ObjectPool
Throws:
Exception - Throws an Exception if an error occurred while trying to create a new object

destroyObject

public void destroyObject(Object object)
Destroy an object that can no longer needed by the ObjectPool. All object resources should be released here.

Parameters:
object - The object to be destroyed.

validateObject

public boolean validateObject(Object object)
Ensures that the Object is safe to be returned by the pool. Returns false if this object should be destroyed.

Parameters:
object - The object to be validated.
Returns:
false if this object is not valid and should be dropped from the pool, true otherwise.


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