|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.pool.BaseObjectPool
public abstract class BaseObjectPool
A simple base implementation of ObjectPool
.
Optional operations are implemented to either do nothing, return a value
indicating it is unsupported or throw UnsupportedOperationException
.
Constructor Summary | |
---|---|
BaseObjectPool()
|
Method Summary | |
---|---|
void |
addObject()
Not supported in this base implementation. |
abstract Object |
borrowObject()
Obtains an instance from the pool. |
void |
clear()
Not supported in this base implementation. |
void |
close()
Close this pool. |
int |
getNumActive()
Not supported in this base implementation. |
int |
getNumIdle()
Not supported in this base implementation. |
abstract void |
invalidateObject(Object obj)
Invalidates an object from the pool. |
abstract void |
returnObject(Object obj)
Returns an instance to the pool. |
void |
setFactory(PoolableObjectFactory 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 BaseObjectPool()
Method Detail |
---|
public void addObject() throws Exception, UnsupportedOperationException
UnsupportedOperationException
,
subclasses should override this behavior.
addObject
in interface ObjectPool
UnsupportedOperationException
Exception
- when PoolableObjectFactory.makeObject()
fails.
IllegalStateException
- after ObjectPool.close()
has been called on this pool.public abstract Object borrowObject() throws Exception
borrowObject
in interface ObjectPool
Exception
- if an instance cannot be obtained from the poolpublic void clear() throws Exception, UnsupportedOperationException
clear
in interface ObjectPool
UnsupportedOperationException
Exception
public void close() throws Exception
isClosed
and assertOpen
.
close
in interface ObjectPool
Exception
- deprecated: implementations should silently fail if not all resources can be freed.public int getNumActive() throws UnsupportedOperationException
getNumActive
in interface ObjectPool
UnsupportedOperationException
public int getNumIdle() throws UnsupportedOperationException
getNumIdle
in interface ObjectPool
UnsupportedOperationException
public abstract void invalidateObject(Object obj) throws Exception
obj
must have been obtained
using borrowObject
or a related method as defined in an implementation
or sub-interface.
This method should be used when an object that has been borrowed is determined (due to an exception or other problem) to be invalid.
invalidateObject
in interface ObjectPool
obj
- a borrowed
instance to be disposed.
Exception
public abstract void returnObject(Object obj) throws Exception
returnObject
in interface ObjectPool
obj
- instance to return to the pool
Exception
public void setFactory(PoolableObjectFactory factory) throws IllegalStateException, UnsupportedOperationException
UnsupportedOperationException
,
subclasses should override this behavior.
setFactory
in interface ObjectPool
factory
- the PoolableObjectFactory
UnsupportedOperationException
IllegalStateException
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |