Package org.apache.commons.pool
Class PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,V>
java.lang.Object
org.apache.commons.pool.PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,V>
- All Implemented Interfaces:
KeyedPoolableObjectFactory<K,
V>
- Enclosing class:
PoolUtils
private static class PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,V>
extends Object
implements KeyedPoolableObjectFactory<K,V>
Adaptor class that turns a PoolableObjectFactory into a KeyedPoolableObjectFactory by
ignoring keys.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PoolableObjectFactory
<V> Underlying PoolableObjectFactory -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new KeyedPoolableObjectFactoryAdaptor using the given PoolableObjectFactory to manage objects. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateObject
(K key, V obj) Activate the object, ignoring the key.void
destroyObject
(K key, V obj) Destroy the object, ignoring the key.makeObject
(K key) Create a new object instance, ignoring the keyvoid
passivateObject
(K key, V obj) Passivate the object, ignoring the key.toString()
boolean
validateObject
(K key, V obj) Validate the object, ignoring the key
-
Field Details
-
factory
Underlying PoolableObjectFactory
-
-
Constructor Details
-
KeyedPoolableObjectFactoryAdaptor
KeyedPoolableObjectFactoryAdaptor(PoolableObjectFactory<V> factory) throws IllegalArgumentException Create a new KeyedPoolableObjectFactoryAdaptor using the given PoolableObjectFactory to manage objects.- Parameters:
factory
- wrapped PoolableObjectFactory- Throws:
IllegalArgumentException
- if the factory is null
-
-
Method Details
-
makeObject
Create a new object instance, ignoring the key- Specified by:
makeObject
in interfaceKeyedPoolableObjectFactory<K,
V> - Parameters:
key
- ignored- Returns:
- newly created object instance
- Throws:
Exception
- if there is a problem creating a new instance, this will be propagated to the code requesting an object.
-
destroyObject
Destroy the object, ignoring the key.- Specified by:
destroyObject
in interfaceKeyedPoolableObjectFactory<K,
V> - Parameters:
key
- ignoredobj
- instance to destroy- Throws:
Exception
- should be avoided as it may be swallowed by the pool implementation.- See Also:
-
validateObject
Validate the object, ignoring the key- Specified by:
validateObject
in interfaceKeyedPoolableObjectFactory<K,
V> - Parameters:
key
- ignoredobj
- object to validate- Returns:
- true if validation is successful
-
activateObject
Activate the object, ignoring the key.- Specified by:
activateObject
in interfaceKeyedPoolableObjectFactory<K,
V> - Parameters:
key
- ignoredobj
- object to be activated- Throws:
Exception
- if there is a problem activatingobj
, this exception may be swallowed by the pool.- See Also:
-
passivateObject
Passivate the object, ignoring the key.- Specified by:
passivateObject
in interfaceKeyedPoolableObjectFactory<K,
V> - Parameters:
key
- ignoredobj
- object to passivate- Throws:
Exception
- if there is a problem passivatingobj
, this exception may be swallowed by the pool.- See Also:
-
toString
-