Package io.aleph.dirigiste
Class Pool<K,V>
java.lang.Object
io.aleph.dirigiste.Pool<K,V>
- All Implemented Interfaces:
IPool<K,
V>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.aleph.dirigiste.IPool
IPool.AcquireCallback<V>, IPool.Controller<K>, IPool.Generator<K,
V> -
Constructor Summary
ConstructorsConstructorDescriptionPool
(IPool.Generator<K, V> generator, IPool.Controller<K> controller, int maxQueueSize, long samplePeriod, long controlPeriod, TimeUnit unit) -
Method Summary
Modifier and TypeMethodDescriptionAcquires an object from the pool, potentially creating one if none is available.void
acquire
(K key, IPool.AcquireCallback<V> callback) Acquires an object from the pool, potentially creating one if none is available.void
Disposes of an object, removing it from the pool.void
Releases an object that has been acquired back to the pool.void
shutdown()
-
Constructor Details
-
Pool
public Pool(IPool.Generator<K, V> generator, IPool.Controller<K> controller, int maxQueueSize, long samplePeriod, long controlPeriod, TimeUnit unit)
-
-
Method Details
-
acquire
Description copied from interface:IPool
Acquires an object from the pool, potentially creating one if none is available. -
acquire
Description copied from interface:IPool
Acquires an object from the pool, potentially creating one if none is available.- Specified by:
acquire
in interfaceIPool<K,
V> - Parameters:
key
- the key of the pooled object being acquired- Returns:
- the object, once it's acquired
- Throws:
InterruptedException
-
release
Description copied from interface:IPool
Releases an object that has been acquired back to the pool. -
dispose
Description copied from interface:IPool
Disposes of an object, removing it from the pool. -
shutdown
public void shutdown()
-