This article intercepts all classes of the concurrent package from the JDK source package, and gives an overview of the overall structure of the package.
Before JDK1.5, in Java to do business concurrency, often need to have a programmer to complete the code implementation, of course, there are some open-source framework to provide these features, but these still do not have the features of the JDK is easy to use. When it comes to high-quality Java multithreading concurrent programming, in order to prevent the occurrence of such phenomena as dead jumping, such as wait (), notify () and synchronized before using Java, often need to consider performance, deadlock, fairness, Many factors, such as resource management and how to avoid the harm of thread safety, often use some more complex security policies, which aggravate the programmer's development burden. Fortunately, after the advent of JDK1.5, the Sun's Great God (Doug LEA) finally launched the Java.util.concurrent Toolkit for us to simplify concurrent completion. With this, developers will effectively reduce the competitive conditions (race conditions) and deadlock threads. The concurrent package solves these problems well and provides us with a more practical model of concurrent programs.
The JDK's Java.util.concurrent package contains two sub-packages atomic and locks.
Java.util.concurrent.atomic
Atomic contains atomic classes.
Java.util.concurrent.locks
Locks package contains lock-related classes, such as lock, condition, etc.
Java.util.concurrent
The concurrent package contains several concurrent tool classes, such as executors, Semaphore, Countdownlatch, Cyclicbarrier, Blockingqueue, and so on.
Resources:
Concurrent usage in Java
Java.util.concurrent Package Source Analysis
Read the JDK source code
The java.util.concurrent package structure of the JDK source JDK