java.util.concurrent Package

java.util.concurrent Package : Utility classes commonly useful in concurrent programming.

Interfaces in java.util.concurrent Package

S.No Interface & Description
1 BlockingDeque<E>

A 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.
2 BlockingQueue<E>

A 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.
3 Callable<V>

A task that returns a result and may throw an exception.
4 CompletableFuture.AsynchronousCompletionTask

A marker interface identifying asynchronous tasks produced by async methods.
5 CompletionService<V>

A service that decouples the production of new asynchronous tasks from the consumption of the results of completed tasks.
6 CompletionStage<T>

A stage of a possibly asynchronous computation, that performs an action or computes a value when another CompletionStage completes.
7 ConcurrentMap<K,V>

A Map providing thread safety and atomicity guarantees.
8 ConcurrentNavigableMap<K,V>

A ConcurrentMap supporting NavigableMap operations, and recursively so for its navigable sub-maps.
9 Delayed

A mix-in style interface for marking objects that should be acted upon after a given delay.
10 Executor

An object that executes submitted Runnable tasks.
11 ExecutorService

An Executor that provides methods to manage termination and methods that can produce a Future for tracking progress of one or more asynchronous tasks.
12 ForkJoinPool.ForkJoinWorkerThreadFactory

Factory for creating new ForkJoinWorkerThreads.
13 ForkJoinPool.ManagedBlocker

Interface for extending managed parallelism for tasks running in ForkJoinPools.
14 Future<V>

A Future represents the result of an asynchronous computation.
15 RejectedExecutionHandler

A handler for tasks that cannot be executed by a ThreadPoolExecutor.
16 RunnableFuture<V>

A Future that is Runnable.
17 RunnableScheduledFuture<V>

A ScheduledFuture that is Runnable.
18 ScheduledExecutorService

An ExecutorService that can schedule commands to run after a given delay, or to execute periodically.
19 ScheduledFuture<V>

A delayed result-bearing action that can be cancelled.
20 ThreadFactory

An object that creates new threads on demand.
21 TransferQueue<E>

A BlockingQueue in which producers may wait for consumers to receive elements.

Classes in java.util.concurrent Package

S.No Class & Description
1 AbstractExecutorService

Provides default implementations of ExecutorService execution methods.
2 ArrayBlockingQueue<E>

A bounded blocking queue backed by an array.
3 CompletableFuture<T>

A Future that may be explicitly completed (setting its value and status), and may be used as a CompletionStage, supporting dependent functions and actions that trigger upon its completion.
4 ConcurrentHashMap<K,V>

A hash table supporting full concurrency of retrievals and high expected concurrency for updates.
5 ConcurrentHashMap.KeySetView<K,V>

A view of a ConcurrentHashMap as a Set of keys, in which additions may optionally be enabled by mapping to a common value.
6 ConcurrentLinkedDeque<E>

An unbounded concurrent deque based on linked nodes.
7 ConcurrentLinkedQueue<E>

An unbounded thread-safe queue based on linked nodes.
8 ConcurrentSkipListMap<K,V>

A scalable concurrent ConcurrentNavigableMap implementation.
9 ConcurrentSkipListSet<E>

A scalable concurrent NavigableSet implementation based on a ConcurrentSkipListMap.
10 CopyOnWriteArrayList<E>

A thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array.
11 CopyOnWriteArraySet<E>

A Set that uses an internal CopyOnWriteArrayList for all of its operations.
12 CountDownLatch

A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes.
13 CountedCompleter<T>

A ForkJoinTask with a completion action performed when triggered and there are no remaining pending actions.
14 CyclicBarrier

A synchronization aid that allows a set of threads to all wait for each other to reach a common barrier point.
15 DelayQueue<E extends Delayed>

An unbounded blocking queue of Delayed elements, in which an element can only be taken when its delay has expired.
16 Exchanger<V>

A synchronization point at which threads can pair and swap elements within pairs.
17 ExecutorCompletionService<V>

A CompletionService that uses a supplied Executor to execute tasks.
18 Executors

Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes defined in this package.
19 ForkJoinPool

An ExecutorService for running ForkJoinTasks.
20 ForkJoinTask<V>

Abstract base class for tasks that run within a ForkJoinPool.
21 ForkJoinWorkerThread

A thread managed by a ForkJoinPool, which executes ForkJoinTasks.
22 FutureTask<V>

A cancellable asynchronous computation.
23 LinkedBlockingDeque<E>

An optionally-bounded blocking deque based on linked nodes.
24 LinkedBlockingQueue<E>

An optionally-bounded blocking queue based on linked nodes.
25 LinkedTransferQueue<E>

An unbounded TransferQueue based on linked nodes.
26 Phaser

A reusable synchronization barrier, similar in functionality to CyclicBarrier and CountDownLatch but supporting more flexible usage.
27 PriorityBlockingQueue<E>

An unbounded blocking queue that uses the same ordering rules as class PriorityQueue and supplies blocking retrieval operations.
28 RecursiveAction

A recursive resultless ForkJoinTask.
29 RecursiveTask<V>

A recursive result-bearing ForkJoinTask.
30 ScheduledThreadPoolExecutor

A ThreadPoolExecutor that can additionally schedule commands to run after a given delay, or to execute periodically.
31 Semaphore

A counting semaphore.
32 SynchronousQueue<E>

A blocking queue in which each insert operation must wait for a corresponding remove operation by another thread, and vice versa.
33 ThreadLocalRandom

A random number generator isolated to the current thread.
34 ThreadPoolExecutor

An ExecutorService that executes each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods.
35 ThreadPoolExecutor.AbortPolicy

A handler for rejected tasks that throws a RejectedExecutionException.
36 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.
37 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.
38 ThreadPoolExecutor.DiscardPolicy

A handler for rejected tasks that silently discards the rejected task.

Enums in java.util.concurrent Package

S.No Enum & Description
1 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.

Exception Classes in java.util.concurrent Package

S.No Exception Class & Description
1 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.
2 CancellationException

Exception indicating that the result of a value-producing task, such as a FutureTask, cannot be retrieved because the task was cancelled.
3 CompletionException

Exception thrown when an error or other exception is encountered in the course of completing a result or task.
4 ExecutionException

Exception thrown when attempting to retrieve the result of a task that aborted by throwing an exception.
5 RejectedExecutionException

Exception thrown by an Executor when a task cannot be accepted for execution.
6 TimeoutException

Exception thrown when a blocking operation times out.

Ask your questions in eHowToNow Forum

Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers

  1. Java – Enumeration Interface
  2. Java Stream mapToDouble() method with example
  3. Java List get() method with example
  4. Java – LongConsumer Interface
  5. Java AbstractQueuedSynchronizer tryAcquireNanos() method with example
  6. Java CompletionStage thenRunAsync() method with example
  7. Java AbstractQueuedSynchronizer isQueued() method with example
  8. Java BlockingQueue offer() method with example
  9. Java AbstractQueuedLongSynchronizer tryAcquireNanos() method with example
  10. Java PrimitiveIterator.OfInt forEachRemaining() method with example
  11. Java ConcurrentMap compute() method with example
  12. Java CompletionStage thenComposeAsync() method with example
  13. Java IntStream limit() method with example
  14. Java – Exchanger Class
  15. Java – Calendar Class

Be the first to comment