|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface PoolableObjectFactory<K,V>
An interface defining life-cycle methods for instances to be served by a ObjectPool
ObjectPool delegates to a PoolableObjectFactory,
createObject is called whenever a new instance is needed.
validateObject is invoked for making sure
they can be borrowed or returned from the pool.
destroyObject is invoked on every instance when it is being "dropped" from the pool.
| Method Summary | |
|---|---|
V |
createObject(K key)
Create an instance that can be served by the pool |
void |
destroyObject(K key,
V value)
Destroy an instance no longer needed by the pool |
boolean |
validateObject(K key,
V value)
Ensures that the instance is safe to be borrowed and returned by the pool |
| Method Detail |
|---|
V createObject(K key)
throws Exception
key - the key used when constructing the object
Exception - if there is a problem creating a new instance
void destroyObject(K key,
V value)
throws Exception
key - the key used when selecting the instancevalue - the instance to be destroyed
Exception - if there is a problem destroying value
boolean validateObject(K key,
V value)
throws Exception
key - the key used when selecting the objectvalue - the instance to be validated
value is not valid and should be dropped from the pool,
true otherwise
Exception - if there is a problem validating value.
an exception should be avoided as it may be swallowed by the pool implementation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||