org.apache.commons.pool
Class BaseKeyedObjectPool
- KeyedObjectPool
public abstract class BaseKeyedObjectPool
A simple base impementation of
ObjectPool
.
All optional operations are implemented as throwing
UnsupportedOperationException
.
$Revision: 155430 $ $Date: 2005-02-26 08:13:28 -0500 (Sat, 26 Feb 2005) $ void | addObject(Object key) - Not supported in this base implementation.
|
abstract Object | borrowObject(Object key) - Obtain an instance from my pool
for the specified key.
|
void | clear() - Not supported in this base implementation.
|
void | clear(Object key) - Not supported in this base implementation.
|
void | close() - Does nothing this base implementation.
|
int | getNumActive() - Not supported in this base implementation.
|
int | getNumActive(Object key) - Not supported in this base implementation.
|
int | getNumIdle() - Not supported in this base implementation.
|
int | getNumIdle(Object key) - Not supported in this base implementation.
|
abstract void | invalidateObject(Object key, Object obj) - Invalidates an object from the pool
By contract, obj MUST have been obtained
using
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.
|
abstract void | returnObject(Object key, Object obj) - Return an instance to my pool.
|
void | setFactory(KeyedPoolableObjectFactory factory) - Not supported in this base implementation.
|
addObject
public void addObject(Object key)
throws Exception,
UnsupportedOperationException
Not supported in this base implementation.
- addObject in interface KeyedObjectPool
borrowObject
public abstract Object borrowObject(Object key)
throws Exception
Obtain an instance from my pool
for the specified key.
By contract, clients MUST return
the borrowed object using
returnObject
,
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 instance in the first place.
- borrowObject in interface KeyedObjectPool
key
- the key used to obtain the object
- an instance from my pool.
clear
public void clear()
throws Exception,
UnsupportedOperationException
Not supported in this base implementation.
- clear in interface KeyedObjectPool
clear
public void clear(Object key)
throws Exception,
UnsupportedOperationException
Not supported in this base implementation.
- clear in interface KeyedObjectPool
close
public void close()
throws Exception
Does nothing this base implementation.
- close in interface KeyedObjectPool
getNumActive
public int getNumActive()
throws UnsupportedOperationException
Not supported in this base implementation.
- getNumActive in interface KeyedObjectPool
getNumActive
public int getNumActive(Object key)
throws UnsupportedOperationException
Not supported in this base implementation.
- getNumActive in interface KeyedObjectPool
getNumIdle
public int getNumIdle()
throws UnsupportedOperationException
Not supported in this base implementation.
- getNumIdle in interface KeyedObjectPool
getNumIdle
public int getNumIdle(Object key)
throws UnsupportedOperationException
Not supported in this base implementation.
- getNumIdle in interface KeyedObjectPool
invalidateObject
public abstract void invalidateObject(Object key,
Object obj)
throws Exception
Invalidates an object from the pool
By contract,
obj MUST have been obtained
using
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.
This method should be used when an object that has been borrowed
is determined (due to an exception or other problem) to be invalid.
If the connection should be validated before or after borrowing,
then the
PoolableObjectFactory.validateObject(Object)
method should be
used instead.
- invalidateObject in interface KeyedObjectPool
obj
- a borrowed
instance to be returned.
returnObject
public abstract void returnObject(Object key,
Object obj)
throws Exception
Return an instance to my pool.
By contract, obj MUST have been obtained
using 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.
- returnObject in interface KeyedObjectPool
key
- the key used to obtain the objectobj
- a borrowed
instance to be returned.
Copyright © 2001-2003 Apache Software Foundation. Documenation generated September 26 2006.