About
Since Java 1.5, java.util.concurrent
- java.util.concurrent.locks. Interfaces and classes providing a framework for locking and waiting for conditions that is distinct from built-in synchronization and monitors.
- Java Concurrency - Atomic Variable Access: A small toolkit of classes that support lock-free thread-safe programming on single variables.
Articles Related
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
- ThreadPoolExecutor: An Java Concurrency - Executor (Thread manager) that executes each submitted task using one of possibly several pooled threads
- ScheduledThreadPoolExecutor additionally schedule commands to run after a given delay, or to execute periodically.
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.