Class PoolUtils.SynchronizedPooledObjectFactory<T>

  • Type Parameters:
    T - pooled object factory type
    All Implemented Interfaces:
    PooledObjectFactory<T>
    Enclosing class:
    PoolUtils

    private static final class PoolUtils.SynchronizedPooledObjectFactory<T>
    extends java.lang.Object
    implements PooledObjectFactory<T>
    A fully synchronized PooledObjectFactory that wraps a PooledObjectFactory and synchronizes access to the wrapped factory methods.

    Note: This should not be used on pool implementations that already provide proper synchronization such as the pools provided in the Commons Pool library.

    • Field Detail

      • writeLock

        private final java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock writeLock
        Synchronization lock
    • Constructor Detail

      • SynchronizedPooledObjectFactory

        SynchronizedPooledObjectFactory​(PooledObjectFactory<T> factory)
                                 throws java.lang.IllegalArgumentException
        Creates a SynchronizedPoolableObjectFactory wrapping the given factory.
        Parameters:
        factory - underlying factory to wrap
        Throws:
        java.lang.IllegalArgumentException - if the factory is null