private static class PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,V> extends java.lang.Object implements KeyedPoolableObjectFactory<K,V>
Modifier and Type | Field and Description |
---|---|
private PoolableObjectFactory<V> |
factory
Underlying PoolableObjectFactory
|
Constructor and Description |
---|
KeyedPoolableObjectFactoryAdaptor(PoolableObjectFactory<V> factory)
Create a new KeyedPoolableObjectFactoryAdaptor using the given PoolableObjectFactory to
manage objects.
|
Modifier and Type | Method and Description |
---|---|
void |
activateObject(K key,
V obj)
Activate the object, ignoring the key.
|
void |
destroyObject(K key,
V obj)
Destroy the object, ignoring the key.
|
V |
makeObject(K key)
Create a new object instance, ignoring the key
|
void |
passivateObject(K key,
V obj)
Passivate the object, ignoring the key.
|
java.lang.String |
toString() |
boolean |
validateObject(K key,
V obj)
Validate the object, ignoring the key
|
private final PoolableObjectFactory<V> factory
KeyedPoolableObjectFactoryAdaptor(PoolableObjectFactory<V> factory) throws java.lang.IllegalArgumentException
factory
- wrapped PoolableObjectFactoryjava.lang.IllegalArgumentException
- if the factory is nullpublic V makeObject(K key) throws java.lang.Exception
makeObject
in interface KeyedPoolableObjectFactory<K,V>
key
- ignoredjava.lang.Exception
- if there is a problem creating a new instance,
this will be propagated to the code requesting an object.public void destroyObject(K key, V obj) throws java.lang.Exception
destroyObject
in interface KeyedPoolableObjectFactory<K,V>
key
- ignoredobj
- instance to destroyjava.lang.Exception
- should be avoided as it may be swallowed by
the pool implementation.KeyedPoolableObjectFactory.validateObject(K, V)
,
KeyedObjectPool.invalidateObject(K, V)
public boolean validateObject(K key, V obj)
validateObject
in interface KeyedPoolableObjectFactory<K,V>
key
- ignoredobj
- object to validatepublic void activateObject(K key, V obj) throws java.lang.Exception
activateObject
in interface KeyedPoolableObjectFactory<K,V>
key
- ignoredobj
- object to be activatedjava.lang.Exception
- if there is a problem activating obj
,
this exception may be swallowed by the pool.KeyedPoolableObjectFactory.destroyObject(K, V)
public void passivateObject(K key, V obj) throws java.lang.Exception
passivateObject
in interface KeyedPoolableObjectFactory<K,V>
key
- ignoredobj
- object to passivatejava.lang.Exception
- if there is a problem passivating obj
,
this exception may be swallowed by the pool.KeyedPoolableObjectFactory.destroyObject(K, V)
public java.lang.String toString()
toString
in class java.lang.Object