Package io.deephaven.util.pool
Class ThreadSafeFixedSizePool<T>
java.lang.Object
io.deephaven.util.pool.ThreadSafeFixedSizePool<T>
A pool that
- holds at least
size
items, - creates
size
items in the pool immediately, - blocks (busily) whenever the pool overflows or underflows,
- optionally clears the items given to it, and
- IS thread-safe
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.base.pool.Pool
Pool.Factory, Pool.MultiGiver<T>, Pool.MultiPool<T>, Pool.MultiTaker<T>, Pool.SinglePool<T>
-
Field Summary
-
Constructor Summary
ConstructorDescriptionThreadSafeFixedSizePool
(int size, Supplier<T> factory, Consumer<T> clearingProcedure) -
Method Summary
-
Field Details
-
MIN_SIZE
public static final int MIN_SIZE- See Also:
-
pool
-
-
Constructor Details
-
ThreadSafeFixedSizePool
-
-
Method Details
-
give
Description copied from interface:Pool
Gives an unused item back to the pool. Passingnull
is safe and has no effect. If the pool has a clearing procedure, the item will be cleared. Depending on pool policy, if the pool is full, this may block, discard the item, or throw aPoolFullException
. -
take
Description copied from interface:Pool
Takes an item from the pool. Depending on pool policy, if there are no items available, this may block, create a new item, or throw aPoolEmptyException
. -
tryTake
Description copied from interface:PoolEx
Take an item if immediately available, else return null.
-