Java Reference
In-Depth Information
C H A P T E R 6
Touring Additional Utility APIs
Chapter 5 introduced youto the Collections Framework, which is a collection ofutility
APIs. Chapter 6 introduces you to additional utility APIs, specifically the concurrency
utilities, Objects , and Random .
Concurrency Utilities
Java5introducedtheconcurrencyutilities,whichareclassesandinterfacesthatsimplify
the development of concurrent (multithreaded) applications. These types are located
in the java.util.concurrent package and in its
java.util.concurrent.atomic and java.util.concurrent.locks
subpackages.
Theconcurrencyutilitiesleveragethelow-levelThreadingAPI(see Chapter4 ) intheir
implementations and provide higher-level building blocks to simplify creating multith-
readed applications. They are organized into executor, synchronizer, concurrent collec-
tion, lock, atomic variable, and additional utility categories.
Executors
Chapter 4 introduced the Threading API, which lets you execute runnable tasks via ex-
pressions such as new Thread(new RunnableTask()).start(); . These ex-
pressions tightly couple task submission with the task's execution mechanics (run on
the current thread, a new thread, or a thread arbitrarily chosen from a pool [group] of
threads).
Note A task isanobjectwhoseclassimplementsthe java.lang.Runnable in-
terface (a runnable task) or the java.util.concurrent.Callable interface (a
callable task).
Search WWH ::




Custom Search