Java Concurrency - java.util.concurrent

About

Since Java 1.5, java.util.concurrent

Executors

(Interfaces|Model)

Executor

See Executor

Future (Results and Execution cancelation)

A Future:

  • returns the results of a function, allows determination of whether execution has completed,
  • and provides a means to cancel execution.

A RunnableFuture is a Future that possesses a run method that upon (during ?) execution, sets its results.

Implementations

ThreadPool

Object

Factory

The Executor Service are normally created and configured using Executors factory methods. The Executors class provides:

  • factory methods for the most common kinds and configurations of Executors,
  • as well as a few utility methods for using them.

Futures

  • FutureTask: base implementation of Future, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. A FutureTask can be used to wrap a Callable or Runnable object.

Completion Service

  • ExecutorCompletionService uses a supplied Executor to execute tasks. This class arranges that submitted tasks are, upon completion, placed on a queue accessible using take. It assists in coordinating the processing of groups of asynchronous tasks.

ForkJoinTask

  • ForkJoinPool: Class ForkJoinPool provides an Executor primarily designed for processing instances of ForkJoinTask and its subclasses. These classes employ a work-stealing scheduler that attains high throughput for tasks conforming to restrictions that often hold in computation-intensive parallel processing.

Documentation / Reference


Powered by ComboStrap