Category: Concurrency

ConcurrencyJavaSERelevant topics

Managing Concurrent Processes

by:

The Concurrency API includes classes that can be used to coordinate tasks among a group of related threads. These classes are designated for use in some …

ConcurrencyJavaSERelevant topics

SkipList and CopyOnWrite Collections

by:

SkipList classes, ConcurrentSkipListSet and ConcurrentSkipListMap, are concurrent versions of their sorted counterparts, TreeSet and TreeMap, respectively. They maintain their elements or keys in the natural ordering …

ConcurrencyJavaSERelevant topics

Blocking Queues

by:

BlockingQueue is just like a regular Queue, except that it includes methods that will wait a specific amount of time to complete an operation. BlockingQueue inherits …

ConcurrencyJavaSERelevant topics

Concurrent Collections

by:

Besides managing threads, Concurrency API includes interfaces and classes that help to coordinate access to collections across multiple tasks. Using concurrent collections is extremely convenient in …

ConcurrencyJavaSERelevant topics

Protecting Data with Atomic Classes

by:

With the release of Concurrency API Java added a new java.util.concurrent.atomic package to help coordinate access to primitive values and object references. As with most classes …

ConcurrencyJavaSERelevant topics

Increasing Concurrency with Pools

by:

Executors class has factory methods that act on a pool of threads, rather than on a single thread. A thread pool is a group of pre-instantiated …

ConcurrencyJavaSERelevant topics

Scheduling tasks using Concurrency API

by:

Oftentimes in Java, there is a need to schedule a task to happen at some future time. Sometimes tasks must be scheduled to happen repeatedly, at …

ConcurrencyJavaSERelevant topics

java.util.concurrent.Callable interface

by:

Callable interface is similar to Runnable except that its call() method returns a value and can throw a checked exception, while run() method of Runnable interface …

ConcurrencyJavaSERelevant topics

Submitting Tasks to ExecutorService

by:

Tasks to an ExecutorService can be submitted in multiple ways. execute() method is inherited from the Executor interface, which ExecutorService interface extends. The execute() method takes …

ConcurrencyJavaSERelevant topics

Shutting Down a Thread Executor

by:

One using a thread executor is finished, it is important to call the shutdown() method on an instance of an ExecutorService interface. A thread executor creates …