POOLABLE
from the pool upon subscription and become responsible for its release.POOLABLE
from the pool upon subscription and become responsible for its release.Pool
, via
either of Pool.acquire()
or Pool.withPoolable(Function)
.acquired
and are in active use, outside of the
control of the pool until they're released back to it.Pool
implementation MAY decide to use the Scheduler
to publish resources in a more deterministic way: the publishing thread would then
always be the same, independently of which thread called Pool.acquire()
or
PooledRef.release()
or on which thread the PoolConfig.allocator()
produced new
resources.Pool
, acquired
or idle.Pool
on whether or not it is possible to invoke the resource allocator.Pool
are driven by the
provided AllocationStrategy
.AllocationStrategy
defines a strategy / limit for the number of pooled object to allocate.PooledRef
was created/allocated,
or an equivalently totally-ordered positive number that can be used to compare in which order
two references have been created (unless created within the same millisecond).Mono
.Pool
, given a Pool factory Function
that
is provided with a PoolConfig
copy of this builder's configuration.Function
.Clock
to use for timestamps, notably marking the times at which a resource is
allocated, released and acquired.Clock
to use to timestamp pool lifecycle events like allocation
and eviction, which can influence eg.configuration
.PoolConfig
that can be extended to bear more configuration options
with access to a copy constructor for the basic options.PoolConfig
.AllocationStrategy
backing this sampling strategy.RuntimeException
releasing each pooled resource, according to the release handler defined in
the PoolBuilder
This imperative style method returns once every release handler has been started in
step 2, but doesn't necessarily block until full completion of said releases.evictionPredicate
is regularly
applied to elements that are idle in the pool when there is no pool activity (i.e.evictionPredicate
is regularly
applied to elements that are idle in the pool when there is no pool activity (i.e.evictionPredicate
is only checked upon acquire
and release
(ie only
when there is pool activity).Duration
representing
the interval at which such checks are made.Scheduler
on
which these checks are made.eviction predicate
to cause eviction (ie returns true
)
of resources that have been idle (ie released and available in the Pool
) for more than the ttl
Duration
(inclusive).BiPredicate
that allows to decide if a resource is fit for being placed in the Pool
.BiPredicate
that checks if a resource should be destroyed (true
) or is still in a valid state
for recycling.PoolConfig
passed to the Pool
factory in PoolBuilder.build(Function)
.Pool
by describing how new objects are to be asynchronously allocated.Pool
will allow.Pool.acquire()
this Pool
can queue in
a pending state when no available resource is immediately handy (and the Pool
cannot allocate more resources).desired
positive number of new resources.SamplingAllocationStrategy.getPermits(int)
calls, as Throwable
that trace back
to the callers of the sampled calls.SamplingAllocationStrategy.getPermits(int)
calls, as a double between 0d and 1d (percentage).gracefully shutdown
,
via GracefulShutdownInstrumentedPool.disposeGracefully(Duration)
.InstrumentedPool
that adds the capacity to gracefully shut down
the pool.Pool.acquire()
will get the Least Recently Used resource
(LRU, ie.Pool.acquire()
will get the Most Recently Used resource
(MRU, ie.Pool.acquire()
is performed (while the pool is under-utilized).Pool
.InstrumentedPool
is a Pool
that exposes a few additional methods
around metrics.Pool
, suitable
for gauge metrics.InstrumentedPool
decorators, which can also be used
via PoolBuilder.buildPoolAndDecorateWith(Function)
.Mono
that triggers the asynchronous invalidation of the POOLABLE
when subscribed.GracefulShutdownInstrumentedPool.disposeGracefully(Duration)
has been invoked.InstrumentedPool.PoolMetrics.acquiredSize()
,
InstrumentedPool.PoolMetrics.idleSize()
, InstrumentedPool.PoolMetrics.pendingAcquireSize()
and InstrumentedPool.PoolMetrics.allocatedSize()
are all at zero
and that the last recorded interaction with the pool (InstrumentedPool.PoolMetrics.secondsSinceLastInteraction()
)
was more than or exactly duration
ago.GracefulShutdownInstrumentedPool.disposeGracefully(Duration)
has been invoked but there are still
pending acquire and the grace period hasn't timed out.PooledRef
: the wall-clock time (in milliseconds) since which the underlying object
has been allocated.Pool.acquire()
Monos that can
be in a pending state (ie they wait for a resource to be released, as no idle
resource was immediately available, and the pool add already allocated the maximum
permitted amount).Pool.acquire()
Monos that can be in a
pending state (ie they wait for a resource to be released, as no idle resource was
immediately available, and the pool add already allocated the maximum permitted amount).PooledRefMetadata
object that holds more information about the reference (rather
than the PooledRef.poolable()
), like how many times it was acquired, its age (time since allocation), etc...PoolMetricsRecorder
for Pool
to use for instrumentation purposes.PoolMetricsRecorder
to use to collect instrumentation data of the Pool
implementations.acquire Monos
in
the Pool
.Pool.acquire(Duration)
call is made and the acquisition is pending.Pool.acquire(Duration)
call is made and the acquisition is pending.0
for scale-to-zero.POOLABLE
.RuntimeException
that rejects a Pool.acquire()
operation due to too
many similar operations being in a pending state waiting for resources to be released.TimeoutException
that denotes that a Pool.acquire(Duration)
has timed out.Pool
.Pool
, which holds the underlying POOLABLE
object and allows one to
manually PooledRef.release()
it to the pool or PooledRef.invalidate()
it.PooledRef
, which includes monotonic metrics like its age
(PooledRefMetadata.lifeTime()
), number of times it was reused (PooledRefMetadata.acquireCount()
), as well
as contextually changing metrics like the duration for which it has been idle in a pool
(PooledRefMetadata.idleTime()
).Pool
to collect instrumentation data.Mono
.Pool
has a fast path of recycling and just used it.Pool
has a slow path of recycling and just used it.Mono
that, once subscribed, will release the POOLABLE
back to the pool asynchronously.released
, defines a mechanism of resetting any lingering state of
the resource in order for it to become usable again.PooledRef
was last released,
or an equivalently totally-ordered positive number that can be used to compare in which order
two references have been released (unless released within the same millisecond).SamplingAllocationStrategy.returnPermits(int)
calls, as Throwable
that trace back
to the callers of the sampled calls.SamplingAllocationStrategy.returnPermits(int)
calls, as a double between 0d and 1d (percentage).Pool
, potentially leaving space
for N new ones to be allocated.Pool.acquire()
is performed.AllocationStrategy
that delegates to an underlying AllocationStrategy
and samples
the SamplingAllocationStrategy.getPermits(int)
and SamplingAllocationStrategy.returnPermits(int)
methods.SimpleDequePool
is based on Deque
for idle resources and pending Pool.acquire()
Monos,
allowing both to be ordered either LIFO or FIFO.SamplingAllocationStrategy
that wraps a sizeBetween
AllocationStrategy
and samples calls to AllocationStrategy.getPermits(int)
and AllocationStrategy.returnPermits(int)
.AllocationStrategy
with one that lets the Pool
allocate new resources
when no idle resource is available, without limit.Pool
, if needed.POOLABLE
object from the pool upon subscription and declaratively use it, automatically releasing
the object back to the pool once the derived usage pipeline terminates or is cancelled.AllocationStrategy
that wraps a delegate
and samples calls to AllocationStrategy.getPermits(int)
and AllocationStrategy.returnPermits(int)
.