public class GenericObjectPool<T> extends Object
| Constructor and Description |
|---|
GenericObjectPool(PoolConfig<T> poolConfig,
@NotNull Allocator<T> allocator) |
| Modifier and Type | Method and Description |
|---|---|
@NotNull PoolableObject<T> |
claim()
Delegates to
claim(Timeout) with unlimited timeout. |
@Nullable PoolableObject<T> |
claim(long timeout,
TimeUnit timeUnit)
Delegates to
claim(Timeout). |
@Nullable PoolableObject<T> |
claim(Timeout timeout)
Will claim available object, create a new one if there is room to grow the pool, or else wait until either become true.
|
int |
getCurrentlyAllocated()
Gets the allocation size.
|
@NotNull PoolMetrics |
getPoolMetrics() |
Future<Void> |
shutdown()
Shuts down the current Pool stopping new allocations and triggering deallocations on all other available objects.
|
public GenericObjectPool(PoolConfig<T> poolConfig, @NotNull @NotNull Allocator<T> allocator)
@NotNull public @NotNull PoolableObject<T> claim() throws InterruptedException
claim(Timeout) with unlimited timeout.InterruptedException@Nullable public @Nullable PoolableObject<T> claim(long timeout, TimeUnit timeUnit) throws InterruptedException
claim(Timeout).InterruptedException@Nullable public @Nullable PoolableObject<T> claim(Timeout timeout) throws InterruptedException, IllegalStateException
IllegalStateException - if you try a new claim while the pool is shut downInterruptedException - if the pool was waiting and the pool shut down in the mean timepublic Future<Void> shutdown()
public int getCurrentlyAllocated()
@NotNull public @NotNull PoolMetrics getPoolMetrics()
PoolMetricsCopyright © 2019–2024. All rights reserved.