MCPcopy Index your code
hub / github.com/apache/tomcat / validateLifetime

Method validateLifetime

java/org/apache/tomcat/dbcp/dbcp2/Utils.java:272–279  ·  view source on GitHub ↗

Throws a LifetimeExceededException if the given pooled object's lifetime has exceeded a maximum duration. @param p The pooled object to test. @param maxDuration The maximum lifetime. @throws LifetimeExceededException Thrown if the given pooled object's lifetime has exceeded a maximum dura

(final PooledObject<?> p, final Duration maxDuration)

Source from the content-addressed store, hash-verified

270 * @throws LifetimeExceededException Thrown if the given pooled object's lifetime has exceeded a maximum duration.
271 */
272 public static void validateLifetime(final PooledObject<?> p, final Duration maxDuration) throws LifetimeExceededException {
273 if (maxDuration.compareTo(Duration.ZERO) > 0) {
274 final Duration lifetimeDuration = Duration.between(p.getCreateInstant(), Instant.now());
275 if (lifetimeDuration.compareTo(maxDuration) > 0) {
276 throw new LifetimeExceededException(getMessage("connectionFactory.lifetimeExceeded", lifetimeDuration, maxDuration));
277 }
278 }
279 }
280
281 private Utils() {
282 // not instantiable

Callers 2

validateLifetimeMethod · 0.95
validateLifetimeMethod · 0.95

Calls 4

getMessageMethod · 0.95
nowMethod · 0.80
compareToMethod · 0.65
getCreateInstantMethod · 0.65

Tested by

no test coverage detected