Enhancements

The CompleteableFuture<T> class received the following enhancements as part of the Java 9 platform:

  • Added time-based enhancements:
    • This enables completions based on lapsed time
    • Delayed executions are now also supported
  • Significant enhancement to subclasses:
    • Extending CompletableFuture is easier
    • Subclasses support alternative default executors

Specifically, the following methods were added in Java 9:

  • newIncompleteFuture()
  • defaultExecutor()
  • copy()
  • minimalCompletionStage()
  • completeAsync()
  • orTimeout()
  • completeOnTimeout()
  • delayedExecutor()
  • completedStage()
  • failedFuture()
  • failedStage()

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.