Class PoolUtils.SynchronizedObjectPool<T>

java.lang.Object
org.apache.commons.pool.PoolUtils.SynchronizedObjectPool<T>
All Implemented Interfaces:
ObjectPool<T>
Enclosing class:
PoolUtils

private static class PoolUtils.SynchronizedObjectPool<T> extends Object implements ObjectPool<T>
A synchronized (thread-safe) ObjectPool backed by the specified ObjectPool.

Note: This should not be used on pool implementations that already provide proper synchronization such as the pools provided in the Commons Pool library. Wrapping a pool that waits for poolable objects to be returned before allowing another one to be borrowed with another layer of synchronization will cause liveliness issues or a deadlock.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Object
    Object whose monitor is used to synchronize methods on the wrapped pool.
    private final ObjectPool<T>
    the underlying object pool
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new SynchronizedObjectPool wrapping the given pool.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Create an object using the factory or other implementation dependent mechanism, passivate it, and then place it in the idle object pool.
    Obtains an instance from this pool.
    void
    Clears any objects sitting idle in the pool, releasing any associated resources (optional operation).
    void
    Close this pool, and free any resources associated with it.
    int
    Return the number of instances currently borrowed from this pool (optional operation).
    int
    Return the number of instances currently idle in this pool (optional operation).
    void
    Invalidates an object from the pool.
    void
    Return an instance to the pool.
    void
    Deprecated.
    to be removed in pool 2.0

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait