private static class PoolUtils.PoolableObjectFactoryAdaptor<K,V> extends java.lang.Object implements PoolableObjectFactory<V>
Modifier and Type | Field and Description |
---|---|
private K |
key
Fixed key
|
private KeyedPoolableObjectFactory<K,V> |
keyedFactory
Wrapped factory
|
Constructor and Description |
---|
PoolableObjectFactoryAdaptor(KeyedPoolableObjectFactory<K,V> keyedFactory,
K key)
Create a PoolableObjectFactoryAdaptor wrapping the provided KeyedPoolableObjectFactory with the
given fixed key.
|
Modifier and Type | Method and Description |
---|---|
void |
activateObject(V obj)
Activate the object, passing the fixed key to the factory.
|
void |
destroyObject(V obj)
Destroy the object, passing the fixed key to the factory.
|
V |
makeObject()
Create an object instance using the configured factory and key.
|
void |
passivateObject(V obj)
Passivate the object, passing the fixed key to the factory.
|
java.lang.String |
toString() |
boolean |
validateObject(V obj)
Validate the object, passing the fixed key to the factory.
|
private final K key
private final KeyedPoolableObjectFactory<K,V> keyedFactory
PoolableObjectFactoryAdaptor(KeyedPoolableObjectFactory<K,V> keyedFactory, K key) throws java.lang.IllegalArgumentException
keyedFactory
- KeyedPoolableObjectFactory that will manage objectskey
- fixed keyjava.lang.IllegalArgumentException
- if either of the parameters is nullpublic V makeObject() throws java.lang.Exception
makeObject
in interface PoolableObjectFactory<V>
java.lang.Exception
- if there is a problem creating a new instance,
this will be propagated to the code requesting an object.public void destroyObject(V obj) throws java.lang.Exception
destroyObject
in interface PoolableObjectFactory<V>
obj
- object to destroyjava.lang.Exception
- should be avoided as it may be swallowed by
the pool implementation.PoolableObjectFactory.validateObject(T)
,
ObjectPool.invalidateObject(T)
public boolean validateObject(V obj)
validateObject
in interface PoolableObjectFactory<V>
obj
- object to validatepublic void activateObject(V obj) throws java.lang.Exception
activateObject
in interface PoolableObjectFactory<V>
obj
- object to activatejava.lang.Exception
- if there is a problem activating obj
,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(T)
public void passivateObject(V obj) throws java.lang.Exception
passivateObject
in interface PoolableObjectFactory<V>
obj
- object to passivatejava.lang.Exception
- if there is a problem passivating obj
,
this exception may be swallowed by the pool.PoolableObjectFactory.destroyObject(T)
public java.lang.String toString()
toString
in class java.lang.Object