public CompletableFuture < T > completeOnTimeout ( T value , long timeout , TimeUnit unit ) { Objects . requireNonNull ( unit ) ; if ( result == null ) whenComplete ( new Canceller ( Delayer . delay ( new DelayedCompleter < T > ( this , value ) , timeout , unit ) ) ) ; return this ; }
Completes this CompletableFuture with the given value if not otherwise completed before the given timeout .