Package com.illumon.util.pool
Class ThreadSafeLenientFixedSizePool<T>
java.lang.Object
com.illumon.util.pool.ThreadSafeLenientFixedSizePool<T>
- All Implemented Interfaces:
com.fishlib.base.pool.Pool<T>,com.fishlib.base.pool.Pool.MultiGiver<T>,com.fishlib.base.pool.Pool.MultiPool<T>,com.fishlib.base.pool.Pool.MultiTaker<T>,com.fishlib.base.pool.Pool.SinglePool<T>,PoolEx<T>
public class ThreadSafeLenientFixedSizePool<T> extends Object implements com.fishlib.base.pool.Pool.MultiPool<T>, PoolEx<T>
A pool that
- holds at least
sizeitems, - creates
sizeitems in the pool immediately, - creates a new item when the pool underflows,
- discards the item when the pool overflows,
- optionally clears the items given to it, and
- IS thread-safe
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.fishlib.base.pool.Pool
com.fishlib.base.pool.Pool.Factory, com.fishlib.base.pool.Pool.MultiGiver<T extends Object>, com.fishlib.base.pool.Pool.MultiPool<T extends Object>, com.fishlib.base.pool.Pool.MultiTaker<T extends Object>, com.fishlib.base.pool.Pool.SinglePool<T extends Object> -
Field Summary
Fields Modifier and Type Field Description static intMIN_SIZE -
Constructor Summary
Constructors Constructor Description ThreadSafeLenientFixedSizePool(String name, int size, com.fishlib.base.Function.Nullary<T> initFactory, com.fishlib.base.Function.Nullary<T> overflowFactory, com.fishlib.base.Procedure.Unary<? super T> clearingProcedure)ThreadSafeLenientFixedSizePool(String name, int size, com.fishlib.base.Function.Unary<T,ThreadSafeLenientFixedSizePool<T>> initFactory, com.fishlib.base.Function.Unary<T,ThreadSafeLenientFixedSizePool<T>> overflowFactory, com.fishlib.base.Procedure.Unary<? super T> clearingProcedure) -
Method Summary
Modifier and Type Method Description voidgive(T item)protected booleangiveInternal(T item)Ttake()TtakeMaybeNull()Deprecated.TtryTake()Take an item if immediately available, else return null.
-
Field Details
-
MIN_SIZE
public static final int MIN_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
ThreadSafeLenientFixedSizePool
-
ThreadSafeLenientFixedSizePool
public ThreadSafeLenientFixedSizePool(String name, int size, com.fishlib.base.Function.Unary<T,ThreadSafeLenientFixedSizePool<T>> initFactory, com.fishlib.base.Function.Unary<T,ThreadSafeLenientFixedSizePool<T>> overflowFactory, com.fishlib.base.Procedure.Unary<? super T> clearingProcedure)
-
-
Method Details
-
take
- Specified by:
takein interfacecom.fishlib.base.pool.Pool<T>
-
give
- Specified by:
givein interfacecom.fishlib.base.pool.Pool<T>
-
giveInternal
-
takeMaybeNull
Deprecated. -
tryTake
Description copied from interface:PoolExTake an item if immediately available, else return null.
-