public abstract class BaseKeyedPoolableObjectFactory<K,V> extends java.lang.Object implements KeyedPoolableObjectFactory<K,V>
构造器和说明 |
---|
BaseKeyedPoolableObjectFactory() |
限定符和类型 | 方法和说明 |
---|---|
void |
activateObject(K key,
V obj)
Reinitialize an instance to be returned by the pool.
|
void |
destroyObject(K key,
V obj)
Destroy an instance no longer needed by the pool.
|
abstract V |
makeObject(K key)
Create an instance that can be served by the pool.
|
void |
passivateObject(K key,
V obj)
Uninitialize an instance to be returned to the idle object pool.
|
boolean |
validateObject(K key,
V obj)
Ensures that the instance is safe to be returned by the pool.
|
public abstract V makeObject(K key) throws java.lang.Exception
makeObject
在接口中 KeyedPoolableObjectFactory<K,V>
key
- the key used when constructing the objectjava.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
The default implementation is a no-op.
destroyObject
在接口中 KeyedPoolableObjectFactory<K,V>
key
- the key used when selecting the instanceobj
- the instance to be destroyedjava.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)
The default implementation always returns true.
validateObject
在接口中 KeyedPoolableObjectFactory<K,V>
key
- the key used when selecting the objectobj
- the instance to be validatedtrue
in the default implementationpublic void activateObject(K key, V obj) throws java.lang.Exception
The default implementation is a no-op.
activateObject
在接口中 KeyedPoolableObjectFactory<K,V>
key
- the key used when selecting the objectobj
- the instance 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
The default implementation is a no-op.
passivateObject
在接口中 KeyedPoolableObjectFactory<K,V>
key
- the key used when selecting the objectobj
- the instance to be passivatedjava.lang.Exception
- if there is a problem passivating obj
,
this exception may be swallowed by the pool.KeyedPoolableObjectFactory.destroyObject(K, V)