...
Future (or alternative)
What are Futures?
CompletableFuture (Java8+)
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.
...
source: https://www.baeldung.com/java-completablefuture
Alternatives
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
int number = 20;
Thread newThread = new Thread(() -> {
System.out.println("Factorial of " + number + " is: " + factorial(number));
});
newThread.start(); |
# | Type | Pros | Cons | Recommend |
---|---|---|---|---|
1 | Future | |||
2 | Thread |
RequestID Generation
Type | Method | Ease of implementation | Recommend |
---|---|---|---|
UUID |
| Easy | Y |
Custom | We generate our own | Medium - Hard | N |
...