InstrumentedPool that adds the capacity to gracefully shut down the pool.
Apply to any InstrumentedPool via the InstrumentedPoolDecorators#gracefulShutdown(InstrumentedPool)
factory method.
Adds the getOriginalPool(), disposeGracefully(Duration), isGracefullyShuttingDown()
and isInGracePeriod() methods.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AtomicLong | |
| pack-priv final Sinks. | |
| pack-priv final AtomicInteger | |
| private static final Logger | |
| pack-priv final InstrumentedPool | |
| pack-priv Disposable | |
| pack-priv final Scheduler |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | acquire()
Implements reactor. POOLABLE from the pool upon subscription and become responsible for its release.
|
| public Mono | acquire(Duration timeout)
Implements reactor. POOLABLE from the pool upon subscription and become responsible for its release.
|
| public PoolConfig | |
| public Mono | Returns: aMono representing the current graceful shutdown of the poolthe maximum gracefulTimeout)Duration for graceful shutdown before full shutdown is forced (resolution: ms)Trigger a "graceful shutdown" of the pool, with a grace period timeout. |
| public Mono | disposeLater()
Implements reactor. Mono that represents a lazy asynchronous shutdown of this Pool.
|
| public InstrumentedPool | |
| public boolean | isDisposed()
Overrides default reactor. |
| public boolean | Returns: true if the pool is in the process of shutting down gracefully, or has already done soCheck if the |
| public boolean | Returns: true if the graceful shutdown is still within the grace period, false otherwiseCheck if the |
| public InstrumentedPool. | |
| private Mono | |
| public Mono |
| acquireTracker | back to summary |
|---|---|
| pack-priv final AtomicLong acquireTracker | |
| gracefulNotifier | back to summary |
|---|---|
| pack-priv final Sinks. | |
| isGracefulShutdown | back to summary |
|---|---|
| pack-priv final AtomicInteger isGracefulShutdown | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| originalPool | back to summary |
|---|---|
| pack-priv final InstrumentedPool<T> originalPool | |
| timeout | back to summary |
|---|---|
| pack-priv Disposable timeout | |
| timeoutScheduler | back to summary |
|---|---|
| pack-priv final Scheduler timeoutScheduler | |
| GracefulShutdownInstrumentedPool | back to summary |
|---|---|
| pack-priv GracefulShutdownInstrumentedPool(InstrumentedPool<T> originalPool) | |
| acquire | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Manually acquire a
This is typically the case when one needs to wrap the actual resource into a decorator version, where the reference
to the
The resulting | |
| acquire | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Manually acquire a
The object is wrapped in a
This is typically the case when one needs to wrap the actual resource into a decorator version, where the reference
to the
The resulting | |
| config | back to summary |
|---|---|
| public PoolConfig Implements reactor. Doc from reactor. Return the pool's
| |
| disposeGracefully | back to summary |
|---|---|
| public Mono Trigger a "graceful shutdown" of the pool, with a grace period timeout.
From there on, calls to
If the wrapper detects that all pending acquires are either
If the timeout triggers before that, the returned
Note that the rejection of new acquires and the grace timer start immediately, irrespective of subscription to the
returned
The timeout runs on the original pool's | |
| disposeLater | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Returns a
If the pool has been already shut down, returns | |
| getOriginalPool | back to summary |
|---|---|
| public InstrumentedPool Return the original pool. Note that in order for this decorator to work correctly, the original pool MUST NOT be used in conjunction with the decorated pool, so use this method carefully.
| |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Overrides default reactor. Doc from reactor. Optionally return true when the resource or task is disposed. Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.
| |
| isGracefullyShuttingDown | back to summary |
|---|---|
| public boolean isGracefullyShuttingDown() Check if the
| |
| isInGracePeriod | back to summary |
|---|---|
| public boolean isInGracePeriod() Check if the
If
| |
| metrics | back to summary |
|---|---|
| public InstrumentedPool. Implements reactor.
| |
| tryGracefulDone | back to summary |
|---|---|
| private Mono | |
| warmup | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Warms up the
Note that no work nor allocation is performed until the Implementations MAY include more behavior, but there is no restriction on the way this method is called by users (it should be possible to call it at any time, as many times as needed or not at all). | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final PooledRef |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | invalidate()
Implements reactor. Mono that triggers the asynchronous invalidation of the POOLABLE when subscribed.
|
| public PooledRefMetadata | metadata()
Implements reactor. PooledRefMetadata object that holds more information about the reference (rather
than the poolable()), like how many times it was acquired, its age (time since allocation), etc...
|
| public T | |
| public Mono | release()
Implements reactor. Mono that, once subscribed, will release the POOLABLE back to the pool asynchronously.
|
| originalRef | back to summary |
|---|---|
| pack-priv final PooledRef<T> originalRef | |
| GracefulRef | back to summary |
|---|---|
| public GracefulRef(PooledRef<T> originalRef) | |
| invalidate | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Return a This is useful when the unhealthy state of the resource (or lack of re-usability) is detected through the usage of the resource, as opposed to its exposed state.
Note that if
| |
| metadata | back to summary |
|---|---|
| public PooledRefMetadata metadata() Implements reactor. Doc from reactor. Returns a
Note that if
| |
| poolable | back to summary |
|---|---|
| public T poolable() Implements reactor. Doc from reactor. Returns the wrapped
The reference is retained by the
| |
| release | back to summary |
|---|---|
| public Mono Implements reactor. Doc from reactor. Return a
This method is idempotent (subsequent subscriptions to the same Mono, or re-invocations of the method
are NO-OP). It is also no-op if | |