Package reactor.pool
Interface PooledRefMetadata
public interface PooledRefMetadata
Metadata about a
PooledRef, which includes monotonic metrics like its age
(lifeTime()), number of times it was reused (acquireCount()), as well
as contextually changing metrics like the duration for which it has been idle in a pool
(idleTime()).- Author:
- Simon Baslé
-
Method Summary
Modifier and TypeMethodDescriptionintReturn the number of times the underlying pooled object has been used by consumers of thePool, via either ofPool.acquire()orPool.withPoolable(Function).longReturn a timestamp that denotes the order in which thePooledRefwas 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).longidleTime()Returns the wall-clock number of milliseconds since the reference was last released (or allocated, if it was never released).longlifeTime()Returns the age of thePooledRef: the wall-clock time (in milliseconds) since which the underlying object has been allocated.default longReturn the effective maximum lifetime in milliseconds for this resource, which may include per-resource jitter to spread renewal over a window.longReturn a timestamp that denotes the order in which thePooledRefwas 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).
-
Method Details
-
acquireCount
int acquireCount()Return the number of times the underlying pooled object has been used by consumers of thePool, via either ofPool.acquire()orPool.withPoolable(Function). The first time an object is allocated, this method returns 1, so the number of times it has been "recycled" can be deduced asacquireCount() - 1.- Returns:
- the number of times this object has been used by consumers of the pool
-
idleTime
long idleTime()Returns the wall-clock number of milliseconds since the reference was last released (or allocated, if it was never released). Can be used on resources that are not currently acquired to detect idle resources. APooledRefthat is currently acquired is required to return 0L.- Returns:
- the wall-clock number of milliseconds since the reference was last released (or allocated, if it was never released)
-
lifeTime
long lifeTime()Returns the age of thePooledRef: the wall-clock time (in milliseconds) since which the underlying object has been allocated.- Returns:
- the wall-clock age (time since allocation) of the underlying object in milliseconds
-
releaseTimestamp
long releaseTimestamp()Return a timestamp that denotes the order in which thePooledRefwas 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). If thePooledRefis currently acquired and held outside the pool, returns zero instead.- Returns:
- the last release timestamp, or zero if currently acquired
-
allocationTimestamp
long allocationTimestamp()Return a timestamp that denotes the order in which thePooledRefwas 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).- Returns:
- the creation timestamp
-
maxLifeTimeMs
default long maxLifeTimeMs()Return the effective maximum lifetime in milliseconds for this resource, which may include per-resource jitter to spread renewal over a window. Returns 0L if max lifetime is not configured.- Returns:
- effective max lifetime in milliseconds, or 0L if disabled
- Since:
- 1.2.4
-