- return Optional.of(FiniteDuration.apply(delay, TimeUnit.NANOSECONDS));
- }
-
- /*
- * We are using tri-state return here to indicate one of three conditions:
- * - if there is no timeout to schedule, return Optional.empty()
- * - if there is a timeout to schedule, return a non-empty optional
- * - if this connections has timed out, return null
- */
- @SuppressFBWarnings(value = "NP_OPTIONAL_RETURN_NULL",
- justification = "Returning null Optional is documented in the API contract.")
- Optional<FiniteDuration> checkTimeout(final long now) {
- return checkTimeout(pending.peek(), now);