...
Will we be able to handle everything "as-is"?
Future or alternative
...
Whats are Futures?
Java 8 introduced the CompletableFuture class. Along with the Future interface, it also implemented the CompletionStage interface. This interface defines the contract for an asynchronous computation step that we can combine with other steps.
CompletableFuture is at the same time a building block and a framework, with about 50 different methods for composing, combining, and executing asynchronous computation steps and handling errors.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
public Future<String> calculateAsync() throws InterruptedException {
CompletableFuture<String> completableFuture = new CompletableFuture<>();
Executors.newCachedThreadPool().submit(() -> {
Thread.sleep(500);
completableFuture.complete("Hello");
return null;
});
return completableFuture;
} |
source: https://www.baeldung.com/java-completablefuture
RequestID Generation
Type | Method |
---|---|
UUID |
|
...