public static interface InstrumentedPool.PoolMetrics
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.
Modifier and Type | Method and Description |
---|---|
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. |
int |
allocatedSize()
Measure the current number of allocated resources in the
Pool , acquired
or idle. |
int |
getMaxAllocatedSize()
Get the maximum number of live resources this
Pool will allow. |
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). |
int |
idleSize()
Measure the current number of idle resources in the
Pool . |
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. |
int |
pendingAcquireSize()
Measure the current number of "pending"
acquire Monos in
the Pool . |
default long |
secondsSinceLastInteraction()
Measure the duration in seconds since the pool was last interacted with in a meaningful way.
|
int acquiredSize()
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()
.int allocatedSize()
Pool
, acquired
or idle.Pool
int idleSize()
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.
int pendingAcquireSize()
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.
default long secondsSinceLastInteraction()
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)...
isInactiveForMoreThan(Duration)
default boolean isInactiveForMoreThan(Duration duration)
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.secondsSinceLastInteraction()
int getMaxAllocatedSize()
Pool
will allow.
A Pool
might be unbounded, in which case this method returns Integer.MAX_VALUE
.
Pool
int getMaxPendingAcquireSize()
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
.
Pool