public static < T > boolean await ( CompletableFuture < T > f , long timeout ) { Exceptions . handleInterrupted ( ( ) -> { try { f . get ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( TimeoutException | ExecutionException e ) { // Not handled here. } } ) ; return isSuccessful ( f ) ; }
Waits for the provided future to be complete and returns true if it was successful false if it failed or did not complete .