Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagejava
titleThread Example
collapsetrue
int number = 20;
Thread newThread = new Thread(() -> {
    System.out.println("Factorial of " + number + " is: " + factorial(number));
});
newThread.start();


#TypeProsConsRecommend
1Future


2Thread


RequestID Generation

TypeMethodEase of implementationRecommend
UUID
String uniqueID = UUID.randomUUID().toString();
EasyY
CustomWe generate our ownMedium - HardN




...