Package org.apache.commons.pool2.impl
Class PoolImplUtils
- java.lang.Object
-
- org.apache.commons.pool2.impl.PoolImplUtils
-
class PoolImplUtils extends Object
Implementation specific utilities.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description PoolImplUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static Class<?>getFactoryType(Class<? extends PooledObjectFactory> factoryClass)Identifies the concrete type of object that an object factory creates.(package private) static booleanisPositive(Duration delay)(package private) static Instantmax(Instant a, Instant b)Returns the greater of twoInstantvalues.(package private) static Instantmin(Instant a, Instant b)Returns the smaller of twoInstantvalues.(package private) static DurationnonNull(Duration value, Duration defaultValue)Returns a non-null duration, value if non-null, otherwise defaultValue.(package private) static ChronoUnittoChronoUnit(TimeUnit timeUnit)Converts aTimeUnitto aChronoUnit.(package private) static DurationtoDuration(long amount, TimeUnit timeUnit)Converts am amount and TimeUnit into a Duration.
-
-
-
Method Detail
-
getFactoryType
static Class<?> getFactoryType(Class<? extends PooledObjectFactory> factoryClass)
Identifies the concrete type of object that an object factory creates.- Parameters:
factoryClass- The factory to examine- Returns:
- the type of object the factory creates
-
isPositive
static boolean isPositive(Duration delay)
-
max
static Instant max(Instant a, Instant b)
Returns the greater of twoInstantvalues. That is, the result is the argument closer to the value ofInstant.MAX. If the arguments have the same value, the result is that same value.- Parameters:
a- an argument.b- another argument.- Returns:
- the larger of
aandb.
-
min
static Instant min(Instant a, Instant b)
Returns the smaller of twoInstantvalues. That is, the result is the argument closer to the value ofInstant.MIN. If the arguments have the same value, the result is that same value.- Parameters:
a- an argument.b- another argument.- Returns:
- the smaller of
aandb.
-
toChronoUnit
static ChronoUnit toChronoUnit(TimeUnit timeUnit)
Converts aTimeUnitto aChronoUnit.- Parameters:
timeUnit- A TimeUnit.- Returns:
- The corresponding ChronoUnit.
-
nonNull
static Duration nonNull(Duration value, Duration defaultValue)
Returns a non-null duration, value if non-null, otherwise defaultValue.- Parameters:
value- May be null.defaultValue- May not be null/- Returns:
- value if non-null, otherwise defaultValue.
-
toDuration
static Duration toDuration(long amount, TimeUnit timeUnit)
Converts am amount and TimeUnit into a Duration.- Parameters:
amount- the amount of the duration, measured in terms of the unit, positive or negativetimeUnit- the unit that the duration is measured in, must have an exact duration, not null- Returns:
- a Duration.
-
-