Java’s built-in support for writing multi-threaded applications, such as the Thread class and the synchronized keyword, are hard to use correctly because they are too low level. Java 5 added the Concurrency Utilities in the java.util.concurrent package and subpackages. The types in these packages have been designed to provide better alternatives to Java’s built-in thread and synchronization features. This chapter discusses the more important types in the Concurrency Utilities, starting from atomic variables and followed by executors, Callable, and Future.
The java.util.concurrent.atomic package provides classes such as AtomicBoolean, AtomicInteger, AtomicLong, and AtomicReference. These ...