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
size
items, - creates
size
items 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 -
Constructor Summary
ConstructorsConstructorDescriptionThreadSafeLenientFixedSizePool
(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 TypeMethodDescriptionvoid
protected boolean
giveInternal
(T item) take()
Deprecated.tryTake()
Take an item if immediately available, else return null.
-
Field Details
-
MIN_SIZE
public static final int MIN_SIZE- See Also:
-
-
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