public abstract class BaseObjectPool<T> extends java.lang.Object implements ObjectPool<T>
| 构造器和说明 |
|---|
BaseObjectPool() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addObject()
Not supported in this base implementation.
|
abstract T |
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(T obj)
Invalidates an object from the pool.
|
boolean |
isClosed()
Has this pool instance been closed.
|
abstract void |
returnObject(T obj)
Returns an instance to the pool.
|
void |
setFactory(PoolableObjectFactory<T> factory)
已过时。
|
public abstract T borrowObject() throws java.lang.Exception
borrowObject 在接口中 ObjectPool<T>java.lang.Exception - if an instance cannot be obtained from the poolpublic abstract void returnObject(T obj) throws java.lang.Exception
returnObject 在接口中 ObjectPool<T>obj - instance to return to the pooljava.lang.Exceptionpublic abstract void invalidateObject(T obj) throws java.lang.Exception
ObjectPoolInvalidates 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.
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 在接口中 ObjectPool<T>obj - a borrowed instance to be disposed.java.lang.Exception - Exceptionpublic int getNumIdle()
throws java.lang.UnsupportedOperationException
getNumIdle 在接口中 ObjectPool<T>java.lang.UnsupportedOperationException - UnsupportedOperationExceptionpublic int getNumActive()
throws java.lang.UnsupportedOperationException
getNumActive 在接口中 ObjectPool<T>java.lang.UnsupportedOperationException - UnsupportedOperationExceptionpublic void clear()
throws java.lang.Exception,
java.lang.UnsupportedOperationException
clear 在接口中 ObjectPool<T>java.lang.UnsupportedOperationException - UnsupportedOperationExceptionjava.lang.Exception - Exceptionpublic void addObject()
throws java.lang.Exception,
java.lang.UnsupportedOperationException
UnsupportedOperationException,
subclasses should override this behavior.addObject 在接口中 ObjectPool<T>java.lang.UnsupportedOperationException - UnsupportedOperationExceptionjava.lang.Exception - Exceptionpublic void close()
throws java.lang.Exception
isClosed and assertOpen.close 在接口中 ObjectPool<T>java.lang.Exception - deprecated: implementations should silently fail if not all resources can be freed.@Deprecated public void setFactory(PoolableObjectFactory<T> factory) throws java.lang.IllegalStateException, java.lang.UnsupportedOperationException
ObjectPoolfactory this pool uses
to create new instances (optional operation). Trying to change
the factory after a pool has been used will frequently
throw an UnsupportedOperationException. It is up to the pool
implementation to determine when it is acceptable to call this method.setFactory 在接口中 ObjectPool<T>factory - the PoolableObjectFactory used to create new instances.java.lang.IllegalStateException - when the factory cannot be set at this timejava.lang.UnsupportedOperationException - if this implementation does not support the operationpublic final boolean isClosed()
true when this pool has been closed.