Example usage for Java org.apache.commons.pool KeyedObjectPool fields, constructors, methods, implement or subclass
The text is from its open source code.
void | addObject(Object key) Create an object using the KeyedPoolableObjectFactory factory or other implementation dependent mechanism, passivate it, and then place it in the idle object pool. |
Object | borrowObject(Object key) Obtains an instance from this pool for the specified key . |
void | clear() Clears the pool, removing all pooled instances (optional operation). |
void | clear(Object key) Clears the specified pool, removing all pooled instances corresponding to the given key (optional operation). |
void | close() Close this pool, and free any resources associated with it. |
int | getNumActive() Returns the total number of instances current borrowed from this pool but not yet returned (optional operation). |
int | getNumActive(Object key) Returns the number of instances currently borrowed from but not yet returned to the pool corresponding to the given key (optional operation). |
int | getNumIdle() Returns the total number of instances currently idle in this pool (optional operation). |
int | getNumIdle(Object key) Returns the number of instances corresponding to the given key currently idle in this pool (optional operation). |
void | invalidateObject(Object key, Object obj) Invalidates an object from the pool By contract, obj must have been obtained using #borrowObject borrowObject or a related method as defined in an implementation or sub-interface using a key that is equivalent to the one used to borrow the Object in the first place. |
void | returnObject(Object key, Object obj) Return an instance to the pool. |
void | setFactory(KeyedPoolableObjectFactory factory) Sets the KeyedPoolableObjectFactory factory the pool uses to create new instances (optional operation). |