ObjectPool.
Optional operations are implemented to either do nothing, return a value
indicating it is unsupported or throw UnsupportedOperationException.
This class is intended to be thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addObject()
Implements org. Not supported in this base implementation. |
| protected final void | |
| public abstract T | borrowObject()
Redeclares org. Borrows an instance from this pool. |
| public void | clear()
Implements org. Not supported in this base implementation. |
| public void | close()
Implements org. Closes this pool, and free any resources associated with it. |
| public int | Returns: a negative value.Implements org. Not supported in this base implementation. |
| public int | Returns: a negative value.Implements org. Not supported in this base implementation. |
| public abstract void | invalidateObject(T obj)
Redeclares org. Invalidates an object from the pool. |
| public final boolean | |
| public abstract void | returnObject(T obj)
Redeclares org. Returns an instance to the pool. |
| protected void | toStringAppendFields(final StringBuilder builder)
Overrides org. Used by sub-classes to include the fields defined by the sub-class in the
|
| closed | back to summary |
|---|---|
| private volatile boolean closed | |
| BaseObjectPool | back to summary |
|---|---|
| public BaseObjectPool() Constructs a new instance. | |
| addObject | back to summary |
|---|---|
| public void addObject() throws Exception Implements org. Not supported in this base implementation. Subclasses should override this behavior.
| |
| assertOpen | back to summary |
|---|---|
| protected final void assertOpen() throws IllegalStateException Throws an
| |
| borrowObject | back to summary |
|---|---|
| public abstract T borrowObject() throws Exception Redeclares org. Doc from org. Borrows an instance from this pool.
Instances returned from this method will have been either newly created
with
By contract, clients must return the borrowed instance
using The behavior of this method when the pool has been exhausted is not strictly specified (although it may be specified by implementations).
| |
| clear | back to summary |
|---|---|
| public void clear() throws Exception Implements org. Not supported in this base implementation.
| |
| close | back to summary |
|---|---|
| public void close() Implements org. Doc from org. Closes this pool, and free any resources associated with it.
Calling Implementations should silently fail if not all resources can be freed.
This affects the behavior of
| |
| getNumActive | back to summary |
|---|---|
| public int getNumActive() Implements org. Not supported in this base implementation.
| |
| getNumIdle | back to summary |
|---|---|
| public int getNumIdle() Implements org. Not supported in this base implementation.
| |
| invalidateObject | back to summary |
|---|---|
| public abstract void invalidateObject(T obj) throws Exception Redeclares org. Doc from org. Invalidates an object from the pool.
By contract, This method should be used when an object that has been borrowed is determined (due to an exception or other problem) to be invalid. | |
| isClosed | back to summary |
|---|---|
| public final boolean isClosed() Has this pool instance been closed.
| |
| returnObject | back to summary |
|---|---|
| public abstract void returnObject(T obj) throws Exception Redeclares org. Doc from org. Returns an instance to the pool. By contract, | |
| toStringAppendFields | back to summary |
|---|---|
| protected void toStringAppendFields(final StringBuilder builder) Overrides org. Doc from org. Used by sub-classes to include the fields defined by the sub-class in the
| |