Package com.nuodb.jdbc.pool
Interface ObjectFactory<K extends ObjectKey,V,I>
-
public interface ObjectFactory<K extends ObjectKey,V,I>The interface represents a factory to create, validate, activate, passivate, close poolable objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidactivateObject(K key, V object, I info)When idle object is borrowed by the given key it's activated before returning from the pool.voidcloseObject(K key, V object, I info)Closes physical object and releases any associated resources.VcreateObject(K key, I info)When no idle objects are available in the pool under given object key, the object pool invokes this method to create new object instance.booleanpassivateObject(K key, V object, I info)Object is passivated before object is returned to the pool.booleanvalidateObject(K key, V object, I info)Before returning object to pool or after validation interval has passed the object can be validated for correctness, such as check for not being stale, out-dated or corrupted.
-
-
-
Method Detail
-
createObject
V createObject(K key, I info) throws Exception
When no idle objects are available in the pool under given object key, the object pool invokes this method to create new object instance.- Parameters:
key- object key to construct new poolable objectinfo- additional info- Returns:
- newly constructed object
- Throws:
Exception- if object can't be constructed
-
validateObject
boolean validateObject(K key, V object, I info)
Before returning object to pool or after validation interval has passed the object can be validated for correctness, such as check for not being stale, out-dated or corrupted.- Parameters:
key- object key to validate provided objectobject- to validateinfo- additional info- Returns:
- true if object is valid or false if object is state, out-dated or corrupted
-
activateObject
void activateObject(K key, V object, I info) throws Exception
When idle object is borrowed by the given key it's activated before returning from the pool.- Parameters:
key- object key to activate provided objectobject- to activateinfo- additional info- Throws:
Exception- if object can't be activated
-
passivateObject
boolean passivateObject(K key, V object, I info)
Object is passivated before object is returned to the pool.- Parameters:
key- object key to activate provided objectobject- to passivateinfo- additional info- Returns:
- boolean true if passivate succeded. false if it failed
-
-