# java.util.concurrent

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

# java.util.concurrent

Utility classes commonly useful in concurrent programming. This package includes a few small standardized extensible frameworks, as well as some classes that provide useful functionality and are otherwise tedious or difficult to implement. Here are brief descriptions of the main components. See also the[java.util.concurrent.locks](https://developer.android.com/reference/java/util/concurrent/locks/package-summary)and[java.util.concurrent.atomic](https://developer.android.com/reference/java/util/concurrent/atomic/package-summary)packages.

## Executors

**Interfaces.** [Executor](https://developer.android.com/reference/java/util/concurrent/Executor)is a simple standardized interface for defining custom thread-like subsystems, including thread pools, asynchronous I/O, and lightweight task frameworks. Depending on which concrete Executor class is being used, tasks may execute in a newly created thread, an existing task-execution thread, or the thread calling[execute](https://developer.android.com/reference/java/util/concurrent/Executor#execute(java.lang.Runnable)), and may execute sequentially or concurrently.[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)provides a more complete asynchronous task execution framework. An ExecutorService manages queuing and scheduling of tasks, and allows controlled shutdown. The[ScheduledExecutorService](https://developer.android.com/reference/java/util/concurrent/ScheduledExecutorService)subinterface and associated interfaces add support for delayed and periodic task execution. ExecutorServices provide methods arranging asynchronous execution of any function expressed as[Callable](https://developer.android.com/reference/java/util/concurrent/Callable), the result-bearing analog of[Runnable](https://developer.android.com/reference/java/lang/Runnable). A[Future](https://developer.android.com/reference/java/util/concurrent/Future)returns the results of a function, allows determination of whether execution has completed, and provides a means to cancel execution. A[RunnableFuture](https://developer.android.com/reference/java/util/concurrent/RunnableFuture)is a`Future`that possesses a`run`method that upon execution, sets its results.

**Implementations.** Classes[ThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor)and[ScheduledThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ScheduledThreadPoolExecutor)provide tunable, flexible thread pools. The[Executors](https://developer.android.com/reference/java/util/concurrent/Executors)class provides factory methods for the most common kinds and configurations of Executors, as well as a few utility methods for using them. Other utilities based on`Executors`include the concrete class[FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask)providing a common extensible implementation of Futures, and[ExecutorCompletionService](https://developer.android.com/reference/java/util/concurrent/ExecutorCompletionService), that assists in coordinating the processing of groups of asynchronous tasks.

Class[ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool)provides an Executor primarily designed for processing instances of[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/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.

## Queues

The[ConcurrentLinkedQueue](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedQueue)class supplies an efficient scalable thread-safe non-blocking FIFO queue. The[ConcurrentLinkedDeque](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedDeque)class is similar, but additionally supports the[Deque](https://developer.android.com/reference/java/util/Deque)interface.

Five implementations in`java.util.concurrent`support the extended[BlockingQueue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)interface, that defines blocking versions of put and take:[LinkedBlockingQueue](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingQueue),[ArrayBlockingQueue](https://developer.android.com/reference/java/util/concurrent/ArrayBlockingQueue),[SynchronousQueue](https://developer.android.com/reference/java/util/concurrent/SynchronousQueue),[PriorityBlockingQueue](https://developer.android.com/reference/java/util/concurrent/PriorityBlockingQueue), and[DelayQueue](https://developer.android.com/reference/java/util/concurrent/DelayQueue). The different classes cover the most common usage contexts for producer-consumer, messaging, parallel tasking, and related concurrent designs.

Extended interface[TransferQueue](https://developer.android.com/reference/java/util/concurrent/TransferQueue), and implementation[LinkedTransferQueue](https://developer.android.com/reference/java/util/concurrent/LinkedTransferQueue)introduce a synchronous`transfer`method (along with related features) in which a producer may optionally block awaiting its consumer.

The[BlockingDeque](https://developer.android.com/reference/java/util/concurrent/BlockingDeque)interface extends`BlockingQueue`to support both FIFO and LIFO (stack-based) operations. Class[LinkedBlockingDeque](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingDeque)provides an implementation.

## Timing

The[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)class provides multiple granularities (including nanoseconds) for specifying and controlling time-out based operations. Most classes in the package contain operations based on time-outs in addition to indefinite waits. In all cases that time-outs are used, the time-out specifies the minimum time that the method should wait before indicating that it timed-out. Implementations make a "best effort" to detect time-outs as soon as possible after they occur. However, an indefinite amount of time may elapse between a time-out being detected and a thread actually executing again after that time-out. All methods that accept timeout parameters treat values less than or equal to zero to mean not to wait at all. To wait "forever", you can use a value of`Long.MAX_VALUE`.

## Synchronizers

Five classes aid common special-purpose synchronization idioms.

- [Semaphore](https://developer.android.com/reference/java/util/concurrent/Semaphore)is a classic concurrency tool.
- [CountDownLatch](https://developer.android.com/reference/java/util/concurrent/CountDownLatch)is a very simple yet very common utility for blocking until a given number of signals, events, or conditions hold.
- A[CyclicBarrier](https://developer.android.com/reference/java/util/concurrent/CyclicBarrier)is a resettable multiway synchronization point useful in some styles of parallel programming.
- A[Phaser](https://developer.android.com/reference/java/util/concurrent/Phaser)provides a more flexible form of barrier that may be used to control phased computation among multiple threads.
- An[Exchanger](https://developer.android.com/reference/java/util/concurrent/Exchanger)allows two threads to exchange objects at a rendezvous point, and is useful in several pipeline designs.

## Concurrent Collections

Besides Queues, this package supplies Collection implementations designed for use in multithreaded contexts:[ConcurrentHashMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap),[ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap),[ConcurrentSkipListSet](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListSet),[CopyOnWriteArrayList](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArrayList), and[CopyOnWriteArraySet](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArraySet). When many threads are expected to access a given collection, a`ConcurrentHashMap`is normally preferable to a synchronized`HashMap`, and a`ConcurrentSkipListMap`is normally preferable to a synchronized`TreeMap`. A`CopyOnWriteArrayList`is preferable to a synchronized`ArrayList`when the expected number of reads and traversals greatly outnumber the number of updates to a list.

The "Concurrent" prefix used with some classes in this package is a shorthand indicating several differences from similar "synchronized" classes. For example`java.util.Hashtable`and`Collections.synchronizedMap(new HashMap())`are synchronized. But[ConcurrentHashMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap)is "concurrent". A concurrent collection is thread-safe, but not governed by a single exclusion lock. In the particular case of ConcurrentHashMap, it safely permits any number of concurrent reads as well as a large number of concurrent writes. "Synchronized" classes can be useful when you need to prevent all access to a collection via a single lock, at the expense of poorer scalability. In other cases in which multiple threads are expected to access a common collection, "concurrent" versions are normally preferable. And unsynchronized collections are preferable when either collections are unshared, or are accessible only when holding other locks.

Most concurrent Collection implementations (including most Queues) also differ from the usual`java.util`conventions in that their[Iterators](https://developer.android.com/reference/java/util/Iterator)and[Spliterators](https://developer.android.com/reference/java/util/Spliterator)provide*weakly consistent*rather than fast-fail traversal:

- they may proceed concurrently with other operations
- they will never throw[ConcurrentModificationException](https://developer.android.com/reference/java/util/ConcurrentModificationException)
- they are guaranteed to traverse elements as they existed upon construction exactly once, and may (but are not guaranteed to) reflect any modifications subsequent to construction.

## Memory Consistency Properties

Chapter 17 ofThe Java Language Specificationdefines the*happens-before* relation on memory operations such as reads and writes of shared variables. The results of a write by one thread are guaranteed to be visible to a read by another thread only if the write operation*happens-before* the read operation. The`synchronized`and`volatile`constructs, as well as the`Thread.start()`and`Thread.join()`methods, can form*happens-before* relationships. In particular:

- Each action in a thread*happens-before*every action in that thread that comes later in the program's order.
- An unlock (`synchronized`block or method exit) of a monitor*happens-before* every subsequent lock (`synchronized`block or method entry) of that same monitor. And because the*happens-before* relation is transitive, all actions of a thread prior to unlocking*happen-before*all actions subsequent to any thread locking that monitor.
- A write to a`volatile`field*happens-before* every subsequent read of that same field. Writes and reads of`volatile`fields have similar memory consistency effects as entering and exiting monitors, but do*not*entail mutual exclusion locking.
- A call to`start`on a thread*happens-before*any action in the started thread.
- All actions in a thread*happen-before* any other thread successfully returns from a`join`on that thread.

The methods of all classes in`java.util.concurrent`and its subpackages extend these guarantees to higher-level synchronization. In particular:

- Actions in a thread prior to placing an object into any concurrent collection*happen-before*actions subsequent to the access or removal of that element from the collection in another thread.
- Actions in a thread prior to the submission of a`Runnable`to an`Executor`*happen-before* its execution begins. Similarly for`Callables`submitted to an`ExecutorService`.
- Actions taken by the asynchronous computation represented by a`Future`*happen-before* actions subsequent to the retrieval of the result via`Future.get()`in another thread.
- Actions prior to "releasing" synchronizer methods such as`Lock.unlock`,`Semaphore.release`, and`CountDownLatch.countDown`*happen-before* actions subsequent to a successful "acquiring" method such as`Lock.lock`,`Semaphore.acquire`,`Condition.await`, and`CountDownLatch.await`on the same synchronizer object in another thread.
- For each pair of threads that successfully exchange objects via an`Exchanger`, actions prior to the`exchange()`in each thread*happen-before* those subsequent to the corresponding`exchange()`in another thread.
- Actions prior to calling`CyclicBarrier.await`and`Phaser.awaitAdvance`(as well as its variants)*happen-before* actions performed by the barrier action, and actions performed by the barrier action*happen-before* actions subsequent to a successful return from the corresponding`await`in other threads.

## Interfaces

|-----------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BlockingDeque](https://developer.android.com/reference/java/util/concurrent/BlockingDeque)\<E\>                                                          | A[Deque](https://developer.android.com/reference/java/util/Deque)that additionally supports blocking operations that wait for the deque to become non-empty when retrieving an element, and wait for space to become available in the deque when storing an element.                               |
| [BlockingQueue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)\<E\>                                                          | A[Queue](https://developer.android.com/reference/java/util/Queue)that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element.                                        |
| [Callable](https://developer.android.com/reference/java/util/concurrent/Callable)\<V\>                                                                    | A task that returns a result and may throw an exception.                                                                                                                                                                                                                                           |
| [CompletableFuture.AsynchronousCompletionTask](https://developer.android.com/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask) | A marker interface identifying asynchronous tasks produced by`async`methods.                                                                                                                                                                                                                       |
| [CompletionService](https://developer.android.com/reference/java/util/concurrent/CompletionService)\<V\>                                                  | A service that decouples the production of new asynchronous tasks from the consumption of the results of completed tasks.                                                                                                                                                                          |
| [CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)\<T\>                                                      | A stage of a possibly asynchronous computation, that performs an action or computes a value when another CompletionStage completes.                                                                                                                                                                |
| [ConcurrentMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentMap)\<K, V\>                                                       | A[Map](https://developer.android.com/reference/java/util/Map)providing thread safety and atomicity guarantees.                                                                                                                                                                                     |
| [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)\<K, V\>                                     | A[ConcurrentMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentMap)supporting[NavigableMap](https://developer.android.com/reference/java/util/NavigableMap)operations, and recursively so for its navigable sub-maps.                                                     |
| [Delayed](https://developer.android.com/reference/java/util/concurrent/Delayed)                                                                           | A mix-in style interface for marking objects that should be acted upon after a given delay.                                                                                                                                                                                                        |
| [Executor](https://developer.android.com/reference/java/util/concurrent/Executor)                                                                         | An object that executes submitted[Runnable](https://developer.android.com/reference/java/lang/Runnable)tasks.                                                                                                                                                                                      |
| [ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)                                                           | An[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that provides methods to manage termination and methods that can produce a[Future](https://developer.android.com/reference/java/util/concurrent/Future)for tracking progress of one or more asynchronous tasks. |
| [Flow.Processor](https://developer.android.com/reference/java/util/concurrent/Flow.Processor)\<T, R\>                                                     | A component that acts as both a Subscriber and Publisher.                                                                                                                                                                                                                                          |
| [Flow.Publisher](https://developer.android.com/reference/java/util/concurrent/Flow.Publisher)\<T\>                                                        | A producer of items (and related control messages) received by Subscribers.                                                                                                                                                                                                                        |
| [Flow.Subscriber](https://developer.android.com/reference/java/util/concurrent/Flow.Subscriber)\<T\>                                                      | A receiver of messages.                                                                                                                                                                                                                                                                            |
| [Flow.Subscription](https://developer.android.com/reference/java/util/concurrent/Flow.Subscription)                                                       | Message control linking a[Publisher](https://developer.android.com/reference/java/util/concurrent/Flow.Publisher)and[Subscriber](https://developer.android.com/reference/java/util/concurrent/Flow.Subscriber).                                                                                    |
| [ForkJoinPool.ForkJoinWorkerThreadFactory](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool.ForkJoinWorkerThreadFactory)         | Factory for creating new[ForkJoinWorkerThread](https://developer.android.com/reference/java/util/concurrent/ForkJoinWorkerThread)s.                                                                                                                                                                |
| [ForkJoinPool.ManagedBlocker](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool.ManagedBlocker)                                   | Interface for extending managed parallelism for tasks running in[ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool)s.                                                                                                                                        |
| [Future](https://developer.android.com/reference/java/util/concurrent/Future)\<V\>                                                                        | A`Future`represents the result of an asynchronous computation.                                                                                                                                                                                                                                     |
| [RejectedExecutionHandler](https://developer.android.com/reference/java/util/concurrent/RejectedExecutionHandler)                                         | A handler for tasks that cannot be executed by a[ThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor).                                                                                                                                             |
| [RunnableFuture](https://developer.android.com/reference/java/util/concurrent/RunnableFuture)\<V\>                                                        | A[Future](https://developer.android.com/reference/java/util/concurrent/Future)that is[Runnable](https://developer.android.com/reference/java/lang/Runnable).                                                                                                                                       |
| [RunnableScheduledFuture](https://developer.android.com/reference/java/util/concurrent/RunnableScheduledFuture)\<V\>                                      | A[ScheduledFuture](https://developer.android.com/reference/java/util/concurrent/ScheduledFuture)that is[Runnable](https://developer.android.com/reference/java/lang/Runnable).                                                                                                                     |
| [ScheduledExecutorService](https://developer.android.com/reference/java/util/concurrent/ScheduledExecutorService)                                         | An[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)that can schedule commands to run after a given delay, or to execute periodically.                                                                                                                |
| [ScheduledFuture](https://developer.android.com/reference/java/util/concurrent/ScheduledFuture)\<V\>                                                      | A delayed result-bearing action that can be cancelled.                                                                                                                                                                                                                                             |
| [ThreadFactory](https://developer.android.com/reference/java/util/concurrent/ThreadFactory)                                                               | An object that creates new threads on demand.                                                                                                                                                                                                                                                      |
| [TransferQueue](https://developer.android.com/reference/java/util/concurrent/TransferQueue)\<E\>                                                          | A[BlockingQueue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)in which producers may wait for consumers to receive elements.                                                                                                                                         |

## Classes

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AbstractExecutorService](https://developer.android.com/reference/java/util/concurrent/AbstractExecutorService)                                                                   | Provides default implementations of[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)execution methods.                                                                                                                                                                                                                                                                                                                                                                                                 |
| [ArrayBlockingQueue](https://developer.android.com/reference/java/util/concurrent/ArrayBlockingQueue)\<E\>                                                                        | A bounded[blocking queue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)backed by an array.                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)\<T\>                                                                          | A[Future](https://developer.android.com/reference/java/util/concurrent/Future)that may be explicitly completed (setting its value and status), and may be used as a[CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage), supporting dependent functions and actions that trigger upon its completion.                                                                                                                                                                                                     |
| [ConcurrentHashMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap)\<K, V\>                                                                       | A hash table supporting full concurrency of retrievals and high expected concurrency for updates.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [ConcurrentHashMap.KeySetView](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView)\<K, V\>                                                 | A view of a ConcurrentHashMap as a[Set](https://developer.android.com/reference/java/util/Set)of keys, in which additions may optionally be enabled by mapping to a common value.                                                                                                                                                                                                                                                                                                                                                                    |
| [ConcurrentLinkedDeque](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedDeque)\<E\>                                                                  | An unbounded concurrent[deque](https://developer.android.com/reference/java/util/Deque)based on linked nodes.                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [ConcurrentLinkedQueue](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedQueue)\<E\>                                                                  | An unbounded thread-safe[queue](https://developer.android.com/reference/java/util/Queue)based on linked nodes.                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)\<K, V\>                                                               | A scalable concurrent[ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)implementation.                                                                                                                                                                                                                                                                                                                                                                                                    |
| [ConcurrentSkipListSet](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListSet)\<E\>                                                                  | A scalable concurrent[NavigableSet](https://developer.android.com/reference/java/util/NavigableSet)implementation based on a[ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap).                                                                                                                                                                                                                                                                                                             |
| [CopyOnWriteArrayList](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArrayList)\<E\>                                                                    | A thread-safe variant of[ArrayList](https://developer.android.com/reference/java/util/ArrayList)in which all mutative operations (`add`,`set`, and so on) are implemented by making a fresh copy of the underlying array.                                                                                                                                                                                                                                                                                                                            |
| [CopyOnWriteArraySet](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArraySet)\<E\>                                                                      | A[Set](https://developer.android.com/reference/java/util/Set)that uses an internal[CopyOnWriteArrayList](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArrayList)for all of its operations.                                                                                                                                                                                                                                                                                                                                |
| [CountDownLatch](https://developer.android.com/reference/java/util/concurrent/CountDownLatch)                                                                                     | A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [CountedCompleter](https://developer.android.com/reference/java/util/concurrent/CountedCompleter)\<T\>                                                                            | A[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask)with a completion action performed when triggered and there are no remaining pending actions.                                                                                                                                                                                                                                                                                                                                                              |
| [CyclicBarrier](https://developer.android.com/reference/java/util/concurrent/CyclicBarrier)                                                                                       | A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [DelayQueue](https://developer.android.com/reference/java/util/concurrent/DelayQueue)\<E extends[Delayed](https://developer.android.com/reference/java/util/concurrent/Delayed)\> | An unbounded[blocking queue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)of[Delayed](https://developer.android.com/reference/java/util/concurrent/Delayed)elements, in which an element generally becomes eligible for removal when its delay has expired.                                                                                                                                                                                                                                                            |
| [Exchanger](https://developer.android.com/reference/java/util/concurrent/Exchanger)\<V\>                                                                                          | A synchronization point at which threads can pair and swap elements within pairs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [ExecutorCompletionService](https://developer.android.com/reference/java/util/concurrent/ExecutorCompletionService)\<V\>                                                          | A[CompletionService](https://developer.android.com/reference/java/util/concurrent/CompletionService)that uses a supplied[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)to execute tasks.                                                                                                                                                                                                                                                                                                                           |
| [Executors](https://developer.android.com/reference/java/util/concurrent/Executors)                                                                                               | Factory and utility methods for[Executor](https://developer.android.com/reference/java/util/concurrent/Executor),[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService),[ScheduledExecutorService](https://developer.android.com/reference/java/util/concurrent/ScheduledExecutorService),[ThreadFactory](https://developer.android.com/reference/java/util/concurrent/ThreadFactory), and[Callable](https://developer.android.com/reference/java/util/concurrent/Callable)classes defined in this package. |
| [Flow](https://developer.android.com/reference/java/util/concurrent/Flow)                                                                                                         | Interrelated interfaces and static methods for establishing flow-controlled components in which[Publishers](https://developer.android.com/reference/java/util/concurrent/Flow.Publisher)produce items consumed by one or more[Subscribers](https://developer.android.com/reference/java/util/concurrent/Flow.Subscriber), each managed by a[Subscription](https://developer.android.com/reference/java/util/concurrent/Flow.Subscription).                                                                                                           |
| [ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool)                                                                                         | An[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)for running[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask)s.                                                                                                                                                                                                                                                                                                                                              |
| [ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask)\<V\>                                                                                    | Abstract base class for tasks that run within a[ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool).                                                                                                                                                                                                                                                                                                                                                                                                            |
| [ForkJoinWorkerThread](https://developer.android.com/reference/java/util/concurrent/ForkJoinWorkerThread)                                                                         | A thread managed by a[ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool), which executes[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask)s.                                                                                                                                                                                                                                                                                                                            |
| [FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask)\<V\>                                                                                        | A cancellable asynchronous computation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [LinkedBlockingDeque](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingDeque)\<E\>                                                                      | An optionally-bounded[blocking deque](https://developer.android.com/reference/java/util/concurrent/BlockingDeque)based on linked nodes.                                                                                                                                                                                                                                                                                                                                                                                                              |
| [LinkedBlockingQueue](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingQueue)\<E\>                                                                      | An optionally-bounded[blocking queue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)based on linked nodes.                                                                                                                                                                                                                                                                                                                                                                                                              |
| [LinkedTransferQueue](https://developer.android.com/reference/java/util/concurrent/LinkedTransferQueue)\<E\>                                                                      | An unbounded[TransferQueue](https://developer.android.com/reference/java/util/concurrent/TransferQueue)based on linked nodes.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Phaser](https://developer.android.com/reference/java/util/concurrent/Phaser)                                                                                                     | A reusable synchronization barrier, similar in functionality to[CyclicBarrier](https://developer.android.com/reference/java/util/concurrent/CyclicBarrier)and[CountDownLatch](https://developer.android.com/reference/java/util/concurrent/CountDownLatch)but supporting more flexible usage.                                                                                                                                                                                                                                                        |
| [PriorityBlockingQueue](https://developer.android.com/reference/java/util/concurrent/PriorityBlockingQueue)\<E\>                                                                  | An unbounded[blocking queue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)that uses the same ordering rules as class[PriorityQueue](https://developer.android.com/reference/java/util/PriorityQueue)and supplies blocking retrieval operations.                                                                                                                                                                                                                                                                        |
| [RecursiveAction](https://developer.android.com/reference/java/util/concurrent/RecursiveAction)                                                                                   | A recursive resultless[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask).                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [RecursiveTask](https://developer.android.com/reference/java/util/concurrent/RecursiveTask)\<V\>                                                                                  | A recursive result-bearing[ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask).                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [ScheduledThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ScheduledThreadPoolExecutor)                                                           | A[ThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor)that can additionally schedule commands to run after a given delay, or to execute periodically.                                                                                                                                                                                                                                                                                                                                                |
| [Semaphore](https://developer.android.com/reference/java/util/concurrent/Semaphore)                                                                                               | A counting semaphore.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [SubmissionPublisher](https://developer.android.com/reference/java/util/concurrent/SubmissionPublisher)\<T\>                                                                      | A[Flow.Publisher](https://developer.android.com/reference/java/util/concurrent/Flow.Publisher)that asynchronously issues submitted (non-null) items to current subscribers until it is closed.                                                                                                                                                                                                                                                                                                                                                       |
| [SynchronousQueue](https://developer.android.com/reference/java/util/concurrent/SynchronousQueue)\<E\>                                                                            | A[blocking queue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)in which each insert operation must wait for a corresponding remove operation by another thread, and vice versa.                                                                                                                                                                                                                                                                                                                                        |
| [ThreadLocalRandom](https://developer.android.com/reference/java/util/concurrent/ThreadLocalRandom)                                                                               | A random number generator (with period 2^64^) isolated to the current thread.                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| [ThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor)                                                                             | An[ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)that executes each submitted task using one of possibly several pooled threads, normally configured using[Executors](https://developer.android.com/reference/java/util/concurrent/Executors)factory methods.                                                                                                                                                                                                                                        |
| [ThreadPoolExecutor.AbortPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.AbortPolicy)                                                     | A handler for rejected tasks that throws a[RejectedExecutionException](https://developer.android.com/reference/java/util/concurrent/RejectedExecutionException).                                                                                                                                                                                                                                                                                                                                                                                     |
| [ThreadPoolExecutor.CallerRunsPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.CallerRunsPolicy)                                           | A handler for rejected tasks that runs the rejected task directly in the calling thread of the`execute`method, unless the executor has been shut down, in which case the task is discarded.                                                                                                                                                                                                                                                                                                                                                          |
| [ThreadPoolExecutor.DiscardOldestPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.DiscardOldestPolicy)                                     | A handler for rejected tasks that discards the oldest unhandled request and then retries`execute`, unless the executor is shut down, in which case the task is discarded.                                                                                                                                                                                                                                                                                                                                                                            |
| [ThreadPoolExecutor.DiscardPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.DiscardPolicy)                                                 | A handler for rejected tasks that silently discards the rejected task.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

## Enums

|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Future.State](https://developer.android.com/reference/java/util/concurrent/Future.State) | Represents the computation state.                                                                                                                                                    |
| [TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)         | A`TimeUnit`represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units. |

## Exceptions

|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BrokenBarrierException](https://developer.android.com/reference/java/util/concurrent/BrokenBarrierException)         | Exception thrown when a thread tries to wait upon a barrier that is in a broken state, or which enters the broken state while the thread is waiting.                                                                |
| [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException)           | Exception indicating that the result of a value-producing task, such as a[FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask), cannot be retrieved because the task was cancelled. |
| [CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)               | Exception thrown when an error or other exception is encountered in the course of completing a result or task.                                                                                                      |
| [ExecutionException](https://developer.android.com/reference/java/util/concurrent/ExecutionException)                 | Exception thrown when attempting to retrieve the result of a task that aborted by throwing an exception.                                                                                                            |
| [RejectedExecutionException](https://developer.android.com/reference/java/util/concurrent/RejectedExecutionException) | Exception thrown by an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)when a task cannot be accepted for execution.                                                                |
| [TimeoutException](https://developer.android.com/reference/java/util/concurrent/TimeoutException)                     | Exception thrown when a blocking operation times out.                                                                                                                                                               |

-

  ## Interfaces

  - [BlockingDeque](https://developer.android.com/reference/java/util/concurrent/BlockingDeque)
  - [BlockingQueue](https://developer.android.com/reference/java/util/concurrent/BlockingQueue)
  - [Callable](https://developer.android.com/reference/java/util/concurrent/Callable)
  - [CompletableFuture.AsynchronousCompletionTask](https://developer.android.com/reference/java/util/concurrent/CompletableFuture.AsynchronousCompletionTask)
  - [CompletionService](https://developer.android.com/reference/java/util/concurrent/CompletionService)
  - [CompletionStage](https://developer.android.com/reference/java/util/concurrent/CompletionStage)
  - [ConcurrentMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentMap)
  - [ConcurrentNavigableMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentNavigableMap)
  - [Delayed](https://developer.android.com/reference/java/util/concurrent/Delayed)
  - [Executor](https://developer.android.com/reference/java/util/concurrent/Executor)
  - [ExecutorService](https://developer.android.com/reference/java/util/concurrent/ExecutorService)
  - [Flow.Processor](https://developer.android.com/reference/java/util/concurrent/Flow.Processor)
  - [Flow.Publisher](https://developer.android.com/reference/java/util/concurrent/Flow.Publisher)
  - [Flow.Subscriber](https://developer.android.com/reference/java/util/concurrent/Flow.Subscriber)
  - [Flow.Subscription](https://developer.android.com/reference/java/util/concurrent/Flow.Subscription)
  - [ForkJoinPool.ForkJoinWorkerThreadFactory](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool.ForkJoinWorkerThreadFactory)
  - [ForkJoinPool.ManagedBlocker](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool.ManagedBlocker)
  - [Future](https://developer.android.com/reference/java/util/concurrent/Future)
  - [RejectedExecutionHandler](https://developer.android.com/reference/java/util/concurrent/RejectedExecutionHandler)
  - [RunnableFuture](https://developer.android.com/reference/java/util/concurrent/RunnableFuture)
  - [RunnableScheduledFuture](https://developer.android.com/reference/java/util/concurrent/RunnableScheduledFuture)
  - [ScheduledExecutorService](https://developer.android.com/reference/java/util/concurrent/ScheduledExecutorService)
  - [ScheduledFuture](https://developer.android.com/reference/java/util/concurrent/ScheduledFuture)
  - [ThreadFactory](https://developer.android.com/reference/java/util/concurrent/ThreadFactory)
  - [TransferQueue](https://developer.android.com/reference/java/util/concurrent/TransferQueue)
-

  ## Classes

  - [AbstractExecutorService](https://developer.android.com/reference/java/util/concurrent/AbstractExecutorService)
  - [ArrayBlockingQueue](https://developer.android.com/reference/java/util/concurrent/ArrayBlockingQueue)
  - [CompletableFuture](https://developer.android.com/reference/java/util/concurrent/CompletableFuture)
  - [ConcurrentHashMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap)
  - [ConcurrentHashMap.KeySetView](https://developer.android.com/reference/java/util/concurrent/ConcurrentHashMap.KeySetView)
  - [ConcurrentLinkedDeque](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedDeque)
  - [ConcurrentLinkedQueue](https://developer.android.com/reference/java/util/concurrent/ConcurrentLinkedQueue)
  - [ConcurrentSkipListMap](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListMap)
  - [ConcurrentSkipListSet](https://developer.android.com/reference/java/util/concurrent/ConcurrentSkipListSet)
  - [CopyOnWriteArrayList](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArrayList)
  - [CopyOnWriteArraySet](https://developer.android.com/reference/java/util/concurrent/CopyOnWriteArraySet)
  - [CountDownLatch](https://developer.android.com/reference/java/util/concurrent/CountDownLatch)
  - [CountedCompleter](https://developer.android.com/reference/java/util/concurrent/CountedCompleter)
  - [CyclicBarrier](https://developer.android.com/reference/java/util/concurrent/CyclicBarrier)
  - [DelayQueue](https://developer.android.com/reference/java/util/concurrent/DelayQueue)
  - [Exchanger](https://developer.android.com/reference/java/util/concurrent/Exchanger)
  - [ExecutorCompletionService](https://developer.android.com/reference/java/util/concurrent/ExecutorCompletionService)
  - [Executors](https://developer.android.com/reference/java/util/concurrent/Executors)
  - [Flow](https://developer.android.com/reference/java/util/concurrent/Flow)
  - [ForkJoinPool](https://developer.android.com/reference/java/util/concurrent/ForkJoinPool)
  - [ForkJoinTask](https://developer.android.com/reference/java/util/concurrent/ForkJoinTask)
  - [ForkJoinWorkerThread](https://developer.android.com/reference/java/util/concurrent/ForkJoinWorkerThread)
  - [FutureTask](https://developer.android.com/reference/java/util/concurrent/FutureTask)
  - [LinkedBlockingDeque](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingDeque)
  - [LinkedBlockingQueue](https://developer.android.com/reference/java/util/concurrent/LinkedBlockingQueue)
  - [LinkedTransferQueue](https://developer.android.com/reference/java/util/concurrent/LinkedTransferQueue)
  - [Phaser](https://developer.android.com/reference/java/util/concurrent/Phaser)
  - [PriorityBlockingQueue](https://developer.android.com/reference/java/util/concurrent/PriorityBlockingQueue)
  - [RecursiveAction](https://developer.android.com/reference/java/util/concurrent/RecursiveAction)
  - [RecursiveTask](https://developer.android.com/reference/java/util/concurrent/RecursiveTask)
  - [ScheduledThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ScheduledThreadPoolExecutor)
  - [Semaphore](https://developer.android.com/reference/java/util/concurrent/Semaphore)
  - [SubmissionPublisher](https://developer.android.com/reference/java/util/concurrent/SubmissionPublisher)
  - [SynchronousQueue](https://developer.android.com/reference/java/util/concurrent/SynchronousQueue)
  - [ThreadLocalRandom](https://developer.android.com/reference/java/util/concurrent/ThreadLocalRandom)
  - [ThreadPoolExecutor](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor)
  - [ThreadPoolExecutor.AbortPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.AbortPolicy)
  - [ThreadPoolExecutor.CallerRunsPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.CallerRunsPolicy)
  - [ThreadPoolExecutor.DiscardOldestPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.DiscardOldestPolicy)
  - [ThreadPoolExecutor.DiscardPolicy](https://developer.android.com/reference/java/util/concurrent/ThreadPoolExecutor.DiscardPolicy)
-

  ## Enums

  - [Future.State](https://developer.android.com/reference/java/util/concurrent/Future.State)
  - [TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)
-

  ## Exceptions

  - [BrokenBarrierException](https://developer.android.com/reference/java/util/concurrent/BrokenBarrierException)
  - [CancellationException](https://developer.android.com/reference/java/util/concurrent/CancellationException)
  - [CompletionException](https://developer.android.com/reference/java/util/concurrent/CompletionException)
  - [ExecutionException](https://developer.android.com/reference/java/util/concurrent/ExecutionException)
  - [RejectedExecutionException](https://developer.android.com/reference/java/util/concurrent/RejectedExecutionException)
  - [TimeoutException](https://developer.android.com/reference/java/util/concurrent/TimeoutException)