Class PoolUtils.SynchronizedKeyedPooledObjectFactory<K,​V>

  • Type Parameters:
    K - pooled object factory key type
    V - pooled object factory key value
    All Implemented Interfaces:
    KeyedPooledObjectFactory<K,​V>
    Enclosing class:
    PoolUtils

    private static final class PoolUtils.SynchronizedKeyedPooledObjectFactory<K,​V>
    extends java.lang.Object
    implements KeyedPooledObjectFactory<K,​V>
    A fully synchronized KeyedPooledObjectFactory that wraps a KeyedPooledObjectFactory 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

      • SynchronizedKeyedPooledObjectFactory

        SynchronizedKeyedPooledObjectFactory​(KeyedPooledObjectFactory<K,​V> keyedFactory)
                                      throws java.lang.IllegalArgumentException
        Creates a SynchronizedKeyedPoolableObjectFactory wrapping the given factory.
        Parameters:
        keyedFactory - underlying factory to wrap
        Throws:
        java.lang.IllegalArgumentException - if the factory is null