|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.pool.BaseKeyedObjectPool
A simple base impementation of ObjectPool
.
All optional operations are implemented as throwing
UnsupportedOperationException
.
Constructor Summary | |
BaseKeyedObjectPool()
|
Method Summary | |
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. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BaseKeyedObjectPool()
Method Detail |
public void addObject(Object key) throws Exception, UnsupportedOperationException
addObject
in interface KeyedObjectPool
public abstract Object borrowObject(Object key) throws Exception
KeyedObjectPool
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
org.apache.commons.pool.KeyedObjectPool
key
- the key used to obtain the objectpublic void clear() throws Exception, UnsupportedOperationException
clear
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
UnsupportedOperationException
- when this implementation doesn't support the operationpublic void clear(Object key) throws Exception, UnsupportedOperationException
clear
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
key
- the key to clearUnsupportedOperationException
- when this implementation doesn't support the operationpublic void close() throws Exception
close
in interface KeyedObjectPool
public int getNumActive() throws UnsupportedOperationException
getNumActive
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
UnsupportedOperationException
- when this implementation doesn't support the operationpublic int getNumActive(Object key) throws UnsupportedOperationException
getNumActive
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
key
- the keyUnsupportedOperationException
- when this implementation doesn't support the operationpublic int getNumIdle() throws UnsupportedOperationException
getNumIdle
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
UnsupportedOperationException
- when this implementation doesn't support the operationpublic int getNumIdle(Object key) throws UnsupportedOperationException
getNumIdle
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
key
- the keyUnsupportedOperationException
- when this implementation doesn't support the operationpublic abstract void invalidateObject(Object key, Object obj) throws Exception
KeyedObjectPool
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(java.lang.Object)
method should be
used instead.
invalidateObject
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
obj
- a borrowed
instance to be returned.public abstract void returnObject(Object key, Object obj) throws Exception
KeyedObjectPool
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
org.apache.commons.pool.KeyedObjectPool
key
- the key used to obtain the objectobj
- a borrowed
instance to be returned.public void setFactory(KeyedPoolableObjectFactory factory) throws IllegalStateException, UnsupportedOperationException
setFactory
in interface KeyedObjectPool
org.apache.commons.pool.KeyedObjectPool
factory
- the KeyedPoolableObjectFactory
I use to create new instances.IllegalStateException
- when the factory cannot be set at this timeUnsupportedOperationException
- when this implementation doesn't support the operation
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |