Class ConcurrentQueueObjectPool<O>
java.lang.Object
org.newsclub.net.unix.pool.ConcurrentQueueObjectPool<O>
- Type Parameters:
O- The object type.
- All Implemented Interfaces:
ObjectPool<O>
An
ObjectPool implemented using ConcurrentLinkedQueue.- Author:
- Christian Kohlschütter
-
Nested Class Summary
Nested classes/interfaces inherited from interface ObjectPool
ObjectPool.Lease<O>, ObjectPool.ObjectSanitizer<T>, ObjectPool.ObjectSupplier<T>Modifier and TypeInterfaceDescriptionstatic interfaceA lease for an object (obtained viaObjectPool.Lease.get()); working with the object is only permitted beforeObjectPool.Lease.close().static interfaceSanitizes a previously leased object so it can be reused by the pool.static interfaceSupplies a leased object. -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentQueueObjectPool(ObjectPool.ObjectSupplier<@NonNull O> supplier, ObjectPool.ObjectSanitizer<@NonNull O> sanitizer, int maxCapacity) Constructs aConcurrentQueueObjectPoolwith the given capacity, supplier and sanitizer. -
Method Summary
-
Constructor Details
-
ConcurrentQueueObjectPool
public ConcurrentQueueObjectPool(ObjectPool.ObjectSupplier<@NonNull O> supplier, ObjectPool.ObjectSanitizer<@NonNull O> sanitizer, int maxCapacity) Constructs aConcurrentQueueObjectPoolwith the given capacity, supplier and sanitizer.- Parameters:
supplier- The supplier.sanitizer- The sanitizer.maxCapacity- The maximum capacity.
-
-
Method Details
-
take
Description copied from interface:ObjectPoolTakes an exclusive lease of an object from the pool. If no existing object is available from the pool, a new one may be provided.- Specified by:
takein interfaceObjectPool<O>- Returns:
- The object.
-