Top Description Inners Methods
reactor.pool

public Interface InstrumentedPool<POOLABLE>

extends Pool<POOLABLE>
Known Direct Implementers
reactor.pool.decorators.GracefulShutdownInstrumentedPool, reactor.pool.AbstractPool
Imports
java.time.Duration

An InstrumentedPool is a Pool that exposes a few additional methods around metrics.
Author
Simon Baslé

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
InstrumentedPool.PoolMetrics

An object that can be used to get live information about a Pool, suitable for gauge metrics.

Method Summary

Modifier and TypeMethod and Description
public InstrumentedPool.PoolMetrics

Returns:

a PoolMetrics object to be used to get live gauges about the Pool
metrics
()

Inherited from reactor.pool.Pool:
acquireacquireconfigdisposedisposeLaterwarmupwithPoolable

Method Detail

metricsback to summary
public InstrumentedPool.PoolMetrics metrics()
Returns:InstrumentedPool.PoolMetrics

a PoolMetrics object to be used to get live gauges about the Pool

reactor.pool back to summary

public Interface InstrumentedPool.PoolMetrics

Known Direct Implementers
reactor.pool.AbstractPool

An object that can be used to get live information about a Pool, suitable for gauge metrics.

getXxx methods are configuration accessors, ie values that won't change over time, whereas other methods can be used as gauges to introspect the current state of the pool.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the number of acquired resources
acquiredSize
()

Measure the current number of resources that have been successfully acquired and are in active use, outside of the control of the pool until they're released back to it.

public int

Returns:

the total number of allocated resources managed by the Pool
allocatedSize
()

Measure the current number of allocated resources in the Pool, acquired or idle.

public int

Returns:

the maximum number of live resources that can be allocated by this Pool
getMaxAllocatedSize
()

Get the maximum number of live resources this Pool will allow.

public int

Returns:

the maximum number of pending acquire that can be enqueued by this Pool
getMaxPendingAcquireSize
()

Get the maximum number of Pool#acquire() this Pool can queue in a pending state when no available resource is immediately handy (and the Pool cannot allocate more resources).

public int

Returns:

the number of idle resources
idleSize
()

Measure the current number of idle resources in the Pool.

public default boolean

Returns:

true if the pool can be considered inactive (see above), false otherwise
isInactiveForMoreThan
(Duration duration)

A convenience way to check the pool is inactive, in the sense that acquiredSize(), idleSize(), pendingAcquireSize() and allocatedSize() are all at zero and that the last recorded interaction with the pool (secondsSinceLastInteraction()) was more than or exactly duration ago.

public int

Returns:

the number of pending acquire
pendingAcquireSize
()

Measure the current number of "pending" acquire Monos in the Pool.

public default long

Returns:

a number of seconds indicative of the time elapsed since last pool interaction
secondsSinceLastInteraction
()

Measure the duration in seconds since the pool was last interacted with in a meaningful way.

Method Detail

acquiredSizeback to summary
public int acquiredSize()

Measure the current number of resources that have been successfully acquired and are in active use, outside of the control of the pool until they're released back to it. This number is only incremented after the resource has been successfully allocated and is about to be handed off to the subscriber of Pool#acquire().

Returns:int

the number of acquired resources

allocatedSizeback to summary
public int allocatedSize()

Measure the current number of allocated resources in the Pool, acquired or idle.

Returns:int

the total number of allocated resources managed by the Pool

getMaxAllocatedSizeback to summary
public int getMaxAllocatedSize()

Get the maximum number of live resources this Pool will allow.

A Pool might be unbounded, in which case this method returns Integer#MAX_VALUE.

Returns:int

the maximum number of live resources that can be allocated by this Pool

getMaxPendingAcquireSizeback to summary
public int getMaxPendingAcquireSize()

Get the maximum number of Pool#acquire() this Pool can queue in a pending state when no available resource is immediately handy (and the Pool cannot allocate more resources).

A Pool pending queue might be unbounded, in which case this method returns Integer#MAX_VALUE.

Returns:int

the maximum number of pending acquire that can be enqueued by this Pool

idleSizeback to summary
public int idleSize()

Measure the current number of idle resources in the Pool.

Note that some resources might be lazily evicted when they're next considered for an incoming Pool#acquire() call. Such resources would still count towards this method.

Returns:int

the number of idle resources

isInactiveForMoreThanback to summary
public default boolean isInactiveForMoreThan(Duration duration)

A convenience way to check the pool is inactive, in the sense that acquiredSize(), idleSize(), pendingAcquireSize() and allocatedSize() are all at zero and that the last recorded interaction with the pool (secondsSinceLastInteraction()) was more than or exactly duration ago.

Returns:boolean

true if the pool can be considered inactive (see above), false otherwise

See Also
secondsSinceLastInteraction()
pendingAcquireSizeback to summary
public int pendingAcquireSize()

Measure the current number of "pending" acquire Monos in the Pool.

An acquire is in the pending state when it is attempted at a point when no idle resource is available in the pool, and no new resource can be created.

Returns:int

the number of pending acquire

secondsSinceLastInteractionback to summary
public default long secondsSinceLastInteraction()

Measure the duration in seconds since the pool was last interacted with in a meaningful way. This is a best effort indicator of pool inactivity, provided the pool counters (acquiredSize(), idleSize(), pendingAcquireSize() and allocatedSize()) are also at zero.

The lower the duration, the greater the chances that an interaction could be occurring in parallel to this call. This is why the duration is truncated to the second. A pool implementation that cannot yet support this measurement MAY choose to return -1 seconds instead.

Interactions include background eviction, disposal of the pool, explicit pool warmup, resource acquisition and release (in the default implementation, any interaction triggering the drain loop)...

Returns:long

a number of seconds indicative of the time elapsed since last pool interaction

See Also
isInactiveForMoreThan(Duration)