-
Sub-task
-
Resolution: Fixed
-
P3
-
9
The work for JEP 266: More Concurrency Updates resulted in the inclusion of enhancements to the `java.util.concurrent` package (and in addition many small implementation improvements not mentioned here).
The main enhancements are:
- the Flow API, which is a low-level API for establishing flow-controlled components.
For example, it can provide the interoperable layer for asynchronous stream-based processing with
non-blocking back pressure.
The interface `java.util.concurrent.Flow` contains a number of nested interfaces that correspond to the
reactive-streams (specification)[http://www.reactive-streams.org/]. `Publisher`s produce items consumed
by one or more `Subscriber`s, each managed by a `Subscription`. Communication relies on a simple form
of flow control (method `Subscription.request`, for communicating back pressure) that can be used to avoid
resource management problems that may otherwise occur in "push" based systems.
- Time-based enhancements to `java.util.concurrent.CompletableFuture` that enable a future to complete with
a value or exceptionally after a certain duration, see methods `orTimeout` and `completeTimeout`.
In addition, a complementary `Executor` returned by the static methods named `delayedExecutor` allow a task
to execute after a certain duration. This may be combined with `Executor` receiving methods on
`CompletableFuture` to support operations with time-delays.
- Improvements to `java.util.concurrent.CompletableFuture` making it easier to subclass, see the methods
`minimalCompletionStage`, `newIncompleteFuture`, and `copy`.
The main enhancements are:
- the Flow API, which is a low-level API for establishing flow-controlled components.
For example, it can provide the interoperable layer for asynchronous stream-based processing with
non-blocking back pressure.
The interface `java.util.concurrent.Flow` contains a number of nested interfaces that correspond to the
reactive-streams (specification)[http://www.reactive-streams.org/]. `Publisher`s produce items consumed
by one or more `Subscriber`s, each managed by a `Subscription`. Communication relies on a simple form
of flow control (method `Subscription.request`, for communicating back pressure) that can be used to avoid
resource management problems that may otherwise occur in "push" based systems.
- Time-based enhancements to `java.util.concurrent.CompletableFuture` that enable a future to complete with
a value or exceptionally after a certain duration, see methods `orTimeout` and `completeTimeout`.
In addition, a complementary `Executor` returned by the static methods named `delayedExecutor` allow a task
to execute after a certain duration. This may be combined with `Executor` receiving methods on
`CompletableFuture` to support operations with time-delays.
- Improvements to `java.util.concurrent.CompletableFuture` making it easier to subclass, see the methods
`minimalCompletionStage`, `newIncompleteFuture`, and `copy`.