org.apache.commons.pool
Class BaseKeyedPoolableObjectFactory

java.lang.Object
  extended by org.apache.commons.pool.BaseKeyedPoolableObjectFactory
All Implemented Interfaces:
KeyedPoolableObjectFactory

public abstract class BaseKeyedPoolableObjectFactory
extends java.lang.Object
implements KeyedPoolableObjectFactory

A base implementation of KeyedPoolableObjectFactory.

All operations defined here are essentially no-op's.

Since:
Pool 1.0
Version:
$Revision: 480413 $ $Date: 2006-11-28 22:16:05 -0700 (Tue, 28 Nov 2006) $
Author:
Rodney Waldhoff
See Also:
KeyedPoolableObjectFactory

Constructor Summary
BaseKeyedPoolableObjectFactory()
           
 
Method Summary
 void activateObject(java.lang.Object key, java.lang.Object obj)
          No-op.
 void destroyObject(java.lang.Object key, java.lang.Object obj)
          No-op.
abstract  java.lang.Object makeObject(java.lang.Object key)
          Create an instance that can be served by the pool.
 void passivateObject(java.lang.Object key, java.lang.Object obj)
          No-op.
 boolean validateObject(java.lang.Object key, java.lang.Object obj)
          This implementation always returns true.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseKeyedPoolableObjectFactory

public BaseKeyedPoolableObjectFactory()
Method Detail

activateObject

public void activateObject(java.lang.Object key,
                           java.lang.Object obj)
                    throws java.lang.Exception
No-op.

Specified by:
activateObject in interface KeyedPoolableObjectFactory
Parameters:
key - the key used when selecting the object
obj - the instance to be activated
Throws:
java.lang.Exception - if there is a problem activating obj, this exception may be swallowed by the pool.
See Also:
KeyedPoolableObjectFactory.destroyObject(java.lang.Object, java.lang.Object)

destroyObject

public void destroyObject(java.lang.Object key,
                          java.lang.Object obj)
                   throws java.lang.Exception
No-op.

Specified by:
destroyObject in interface KeyedPoolableObjectFactory
Parameters:
key - the key used when selecting the instance
obj - the instance to be destroyed
Throws:
java.lang.Exception - should be avoided as it may be swallowed by the pool implementation.
See Also:
KeyedPoolableObjectFactory.validateObject(java.lang.Object, java.lang.Object), KeyedObjectPool.invalidateObject(java.lang.Object, java.lang.Object)

makeObject

public abstract java.lang.Object makeObject(java.lang.Object key)
                                     throws java.lang.Exception
Description copied from interface: KeyedPoolableObjectFactory
Create an instance that can be served by the pool. Instances returned from this method should be in the same state as if they had been activated. They will not be activated before being served by the pool.

Specified by:
makeObject in interface KeyedPoolableObjectFactory
Parameters:
key - the key used when constructing the object
Returns:
an instance that can be served by the pool.
Throws:
java.lang.Exception - if there is a problem creating a new instance, this will be propagated to the code requesting an object.

passivateObject

public void passivateObject(java.lang.Object key,
                            java.lang.Object obj)
                     throws java.lang.Exception
No-op.

Specified by:
passivateObject in interface KeyedPoolableObjectFactory
Parameters:
key - the key used when selecting the object
obj - the instance to be passivated
Throws:
java.lang.Exception - if there is a problem passivating obj, this exception may be swallowed by the pool.
See Also:
KeyedPoolableObjectFactory.destroyObject(java.lang.Object, java.lang.Object)

validateObject

public boolean validateObject(java.lang.Object key,
                              java.lang.Object obj)
This implementation always returns true.

Specified by:
validateObject in interface KeyedPoolableObjectFactory
Parameters:
key - the key used when selecting the object
obj - the instance to be validated
Returns:
true


Copyright © 2001-2003 Apache Software Foundation. Documenation generated February 11 2009.