Class Pool<K,V>

java.lang.Object
io.aleph.dirigiste.Pool<K,V>
All Implemented Interfaces:
IPool<K,V>

public class Pool<K,V> extends Object implements IPool<K,V>
  • Constructor Details

  • Method Details

    • acquire

      public void acquire(K key, IPool.AcquireCallback<V> callback)
      Description copied from interface: IPool
      Acquires an object from the pool, potentially creating one if none is available.
      Specified by:
      acquire in interface IPool<K,V>
      Parameters:
      key - the key of the pooled object being acquired
      callback - the callback that will be invoked with the object once it's available
    • acquire

      public V acquire(K key) throws InterruptedException
      Description copied from interface: IPool
      Acquires an object from the pool, potentially creating one if none is available.
      Specified by:
      acquire in interface IPool<K,V>
      Parameters:
      key - the key of the pooled object being acquired
      Returns:
      the object, once it's acquired
      Throws:
      InterruptedException
    • release

      public void release(K key, V obj)
      Description copied from interface: IPool
      Releases an object that has been acquired back to the pool.
      Specified by:
      release in interface IPool<K,V>
      Parameters:
      key - the key of the pooled object being released
      obj - the pooled object being released
    • dispose

      public void dispose(K key, V obj)
      Description copied from interface: IPool
      Disposes of an object, removing it from the pool.
      Specified by:
      dispose in interface IPool<K,V>
      Parameters:
      key - the key of the pooled object being disposed
      obj - the pooled object being disposed
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface IPool<K,V>