Thursday, July 25, 2019

CompletableFuture

Java CompletableFuture Tutorial with Examples
  • What’s a CompletableFuture?
  • Future vs CompletableFuture
  • Limitations of Future
  • Creating a CompletableFuture
  • Running asynchronous computation using runAsync()
  • Run a task asynchronously and return the result using supplyAsync()
  • ForkJoinPool.commonPool()
  • Transforming and acting on a CompletableFuture
    • thenApply()
    • thenAccept() and thenRun()
  • async callback methods
  • Combining two CompletableFutures together
    • Combine two dependent futures using thenCompose()
    • Combine two independent futures using thenCombine()
  • Combining multiple CompletableFutures together
    • CompletableFuture.allOf()
    • CompletableFuture.anyOf()
  • CompletableFuture Exception Handling
    • Handle exceptions using exceptionally() callback
    • Handle exceptions using the generic handle() method





No comments:

Post a Comment