orTimeout() method of CompletableFuture object in Java
This method was introduced from Java 9.
1 |
CompletableFuture<T> orTimeout(long timeout, TimeUnit unit) |
This method is used to specify that if our task does not complete within a certain period of time, the program will stop and be TimeoutException. In the following example, I want to calculate the sum of… Read More