core/play/src/main/java/play/libs/concurrent/DefaultFutures.java
@Override
  public <A> CompletionStage<A> timeout(final CompletionStage<A> stage, final Duration duration) {
    requireNonNull(stage, "Null stage");
    requireNonNull(duration, "Null duration");

    FiniteDuration finiteDuration =
        FiniteDuration.apply(duration.toMillis(), TimeUnit.MILLISECONDS);
    return toJava(delegate.timeout(finiteDuration, Scala.asScalaWithFuture(() -> stage)));
  }
@Override
  public <A> CompletionStage<A> timeout(final CompletionStage<A> stage, final Duration duration) {
    requireNonNull(stage, "Null stage");
    requireNonNull(duration, "Null duration");

    FiniteDuration finiteDuration =
        FiniteDuration.apply(duration.toMillis(), TimeUnit.MILLISECONDS);
    return toJava(delegate.timeout(finiteDuration, Scala.asScalaWithFuture(() -> stage)));
  }
@ Override public < A > CompletionStage < A > timeout ( final CompletionStage < A > stage , final Duration duration ) { requireNonNull ( stage , "Null stage" ) ; requireNonNull ( duration , "Null duration" ) ; FiniteDuration finiteDuration = FiniteDuration . apply ( duration . toMillis ( ) , TimeUnit . MILLISECONDS ) ; return toJava ( delegate . timeout ( finiteDuration , Scala . asScalaWithFuture ( ( ) -> stage ) ) ) ; }
An alias for futures(stage, delay, unit) that uses a java.time.Duration.

@param stage the input completion stage that may time out.
@param duration The duration after which there is a timeout.
@param <A> the completion stage that should be wrapped with a future.
@return the completion stage, or a completion stage that failed with futures.
An alias for futures ( stage delay unit ) that uses a java . time . Duration .