Archive Post

Defining Tasks That Return a Result – Concurrency: Part II

Defining Tasks That Return a Result Implementations of the java.util.concurrent.Callable<V> functional interface represent tasks that…

Representing Task Results – Concurrency: Part II

Representing Task Results A Future<V> object represents the result of a task that is asynchronously…

Scheduling One-Shot Tasks – Concurrency: Part II

Scheduling One-Shot Tasks The overloaded schedule() method of the ScheduledExecutorService interface allows either a Runnable…

Scheduling Periodic Tasks – Concurrency: Part II

Scheduling Periodic Tasks The ScheduledExecutorService interface provides two methods that can be used to schedule…

Task Cancellation – Concurrency: Part II

Task Cancellation Task cancellation is an important aspect of controlling task execution. Here we look…

The Fork/Join Framework – Concurrency: Part II

23.3 The Fork/Join Framework To harness the benefits of multicore architectures, the Fork/Join Framework in…

Writing Thread-Safe Code – Concurrency: Part II

23.4 Writing Thread-Safe Code Thread-safety is a critical property of a concurrent application. Threads can…

Atomic Variables 2 – Concurrency: Part II

The while loop ensures that the value is always incremented by 1 from the previous…

Atomic Variables – Concurrency: Part II

Atomic Variables Unless the action on a shared volatile variable is atomic, thread-safety cannot be…

Reentrant Lock 2 – Concurrency: Part II

More details are provided below about the lock acquisition policy implemented by the methods mentioned…