public abstract class BaseObjectPool extends java.lang.Object implements ObjectPool
ObjectPool.
Optional operations are implemented to either do nothing, return a value
indicating it is unsupported or throw UnsupportedOperationException.| Constructor and Description |
|---|
BaseObjectPool() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObject()
Not supported in this base implementation.
|
abstract java.lang.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(java.lang.Object obj)
Invalidates an object from the pool.
|
abstract void |
returnObject(java.lang.Object obj)
Returns an instance to the pool.
|
void |
setFactory(PoolableObjectFactory factory)
Not supported in this base implementation.
|
public void addObject()
throws java.lang.Exception,
java.lang.UnsupportedOperationException
UnsupportedOperationException,
subclasses should override this behavior.addObject in interface ObjectPooljava.lang.UnsupportedOperationExceptionjava.lang.Exception - when PoolableObjectFactory.makeObject() fails.java.lang.IllegalStateException - after ObjectPool.close() has been called on this pool.public abstract java.lang.Object borrowObject()
throws java.lang.Exception
borrowObject in interface ObjectPooljava.lang.Exception - if an instance cannot be obtained from the poolpublic void clear()
throws java.lang.Exception,
java.lang.UnsupportedOperationException
clear in interface ObjectPooljava.lang.UnsupportedOperationExceptionjava.lang.Exceptionpublic void close()
throws java.lang.Exception
isClosed and assertOpen.close in interface ObjectPooljava.lang.Exception - deprecated: implementations should silently fail if not all resources can be freed.public int getNumActive()
throws java.lang.UnsupportedOperationException
getNumActive in interface ObjectPooljava.lang.UnsupportedOperationExceptionpublic int getNumIdle()
throws java.lang.UnsupportedOperationException
getNumIdle in interface ObjectPooljava.lang.UnsupportedOperationExceptionpublic abstract void invalidateObject(java.lang.Object obj)
throws java.lang.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 ObjectPoolobj - a borrowed instance to be disposed.java.lang.Exceptionpublic abstract void returnObject(java.lang.Object obj)
throws java.lang.Exception
returnObject in interface ObjectPoolobj - instance to return to the pooljava.lang.Exceptionpublic void setFactory(PoolableObjectFactory factory) throws java.lang.IllegalStateException, java.lang.UnsupportedOperationException
UnsupportedOperationException,
subclasses should override this behavior.setFactory in interface ObjectPoolfactory - the PoolableObjectFactoryjava.lang.UnsupportedOperationExceptionjava.lang.IllegalStateExceptionCopyright © 2001-2003 Apache Software Foundation. Documenation generated November 21 2014.