Package org.apache.tomcat.dbcp.pool2
Class BaseKeyedPooledObjectFactory<K,V>
- java.lang.Object
- 
- org.apache.tomcat.dbcp.pool2.BaseObject
- 
- org.apache.tomcat.dbcp.pool2.BaseKeyedPooledObjectFactory<K,V>
 
 
- 
- Type Parameters:
- K- The type of keys managed by this factory.
- V- Type of element managed by this factory.
 - All Implemented Interfaces:
- KeyedPooledObjectFactory<K,V>
 
 public abstract class BaseKeyedPooledObjectFactory<K,V> extends BaseObject implements KeyedPooledObjectFactory<K,V> A base implementation ofKeyedPooledObjectFactory.All operations defined here are essentially no-op's. This class is immutable, and therefore thread-safe. - Since:
- 2.0
- See Also:
- KeyedPooledObjectFactory
 
- 
- 
Constructor SummaryConstructors Constructor Description BaseKeyedPooledObjectFactory()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactivateObject(K key, PooledObject<V> p)Reinitialize an instance to be returned by the pool.abstract Vcreate(K key)Create an instance that can be served by the pool.voiddestroyObject(K key, PooledObject<V> p)Destroy an instance no longer needed by the pool.PooledObject<V>makeObject(K key)Create an instance that can be served by the pool and wrap it in aPooledObjectto be managed by the pool.voidpassivateObject(K key, PooledObject<V> p)Uninitialize an instance to be returned to the idle object pool.booleanvalidateObject(K key, PooledObject<V> p)Ensures that the instance is safe to be returned by the pool.abstract PooledObject<V>wrap(V value)Wrap the provided instance with an implementation ofPooledObject.- 
Methods inherited from class org.apache.tomcat.dbcp.pool2.BaseObjecttoString, toStringAppendFields
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.tomcat.dbcp.pool2.KeyedPooledObjectFactorydestroyObject
 
- 
 
- 
- 
- 
Method Detail- 
createpublic abstract V create(K key) throws java.lang.Exception Create an instance that can be served by the pool.- 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.
 
 - 
wrappublic abstract PooledObject<V> wrap(V value) Wrap the provided instance with an implementation ofPooledObject.- Parameters:
- value- the instance to wrap
- Returns:
- The provided instance, wrapped by a PooledObject
 
 - 
makeObjectpublic PooledObject<V> makeObject(K key) throws java.lang.Exception Description copied from interface:KeyedPooledObjectFactoryCreate an instance that can be served by the pool and wrap it in aPooledObjectto be managed by the pool.- Specified by:
- makeObjectin interface- KeyedPooledObjectFactory<K,V>
- Parameters:
- key- the key used when constructing the object
- Returns:
- a PooledObjectwrapping 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.
 
 - 
destroyObjectpublic void destroyObject(K key, PooledObject<V> p) throws java.lang.Exception Destroy an instance no longer needed by the pool.The default implementation is a no-op. - Specified by:
- destroyObjectin interface- KeyedPooledObjectFactory<K,V>
- Parameters:
- key- the key used when selecting the instance
- p- a- PooledObjectwrapping the instance to be destroyed
- Throws:
- java.lang.Exception- should be avoided as it may be swallowed by the pool implementation.
- See Also:
- KeyedPooledObjectFactory.validateObject(K, org.apache.tomcat.dbcp.pool2.PooledObject<V>),- KeyedObjectPool.invalidateObject(K, V)
 
 - 
validateObjectpublic boolean validateObject(K key, PooledObject<V> p) Ensures that the instance is safe to be returned by the pool.The default implementation always returns true.- Specified by:
- validateObjectin interface- KeyedPooledObjectFactory<K,V>
- Parameters:
- key- the key used when selecting the object
- p- a- PooledObjectwrapping the instance to be validated
- Returns:
- always truein the default implementation
 
 - 
activateObjectpublic void activateObject(K key, PooledObject<V> p) throws java.lang.Exception Reinitialize an instance to be returned by the pool.The default implementation is a no-op. - Specified by:
- activateObjectin interface- KeyedPooledObjectFactory<K,V>
- Parameters:
- key- the key used when selecting the object
- p- a- PooledObjectwrapping 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:
- KeyedPooledObjectFactory.destroyObject(K, org.apache.tomcat.dbcp.pool2.PooledObject<V>)
 
 - 
passivateObjectpublic void passivateObject(K key, PooledObject<V> p) throws java.lang.Exception Uninitialize an instance to be returned to the idle object pool.The default implementation is a no-op. - Specified by:
- passivateObjectin interface- KeyedPooledObjectFactory<K,V>
- Parameters:
- key- the key used when selecting the object
- p- a- PooledObjectwrapping 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:
- KeyedPooledObjectFactory.destroyObject(K, org.apache.tomcat.dbcp.pool2.PooledObject<V>)
 
 
- 
 
-