Java concurrent package java.util.concurrent package structure overview

introduction

        A large number of chapters have been used to introduce threads, Java memory model, synchronized locks, etc. in detail. At the same time, it is also clear that most of the content is revolving around the atomicity, visibility and ordering of concurrent processes. Discussion, in addition to implicit locks such as synchronized, the explicit locks supported by the Lock object mentioned above can also support these three characteristics. From the beginning of this chapter, we will focus on the discussion of explicit locking of Lock objects.

        The explicit lock of the Lock object is actually an important part of the Java concurrent package (java.util.concurrent), which was introduced after J2EE5.0. It is more powerful and flexible than the synchronized implicit lock, and the operation of the lock is less expensive. Mastering this part of the content is indispensable in order to be comfortable in the concurrent development process.

        In order to have a deeper understanding of the content of this part, the next chapters will start with the basic components at the bottom. To know what is in your heart, rather than knowing what it is and not knowing why. The Java concurrent package (java.util.concurrent) can also be referred to as JUC, which can be divided into the following parts, which will be studied in the following order.

  1. Java concurrent package basic components : sun.misc.Unsafe class, LockSupport
  2. Java concurrency core framework : AbstractQueuedSynchronizer , Condition interface, Lock interface
  3. Java concurrent packet synchronization components : ReentrantLock , CylicBarrer, Semaphore, CountDownLatch, ReadWriteLock, ReentrantReadWriteLock, StampedLock, Phaser (based on AtomicReference)
  4. Atomic classes of synchronized data structures : AtomicInteger, AtomicBoolean, AtomicLong, AtomicReference, etc.
  5. Queue class of synchronization data structure : BlockingQueue interface, ArrayBlockingQueue , ConcurrentLinkedQueue, LinkedTransferQueue, PriorityBlockingQueue, DelayQueue, SynchronousQueue
  6. Deque class of synchronous data structure : BlockingDeque interface, ConcurrentLinkedDeque, LinkedBlockingDeque
  7. List class of synchronous data structure : CopyOnWriteArrayList
  8. Set class of synchronous data structure : CopyOnWriteArraySet, ConcurrentSkipListSet
  9. Map class of synchronous data structure : ConcurrentMap interface, ConcurrentHashMap , ConcurrentNavigableMap, ConcurrentSkipListMap
  10. 线程池:Executor、ExecutorService、ExecutorCompletionService、Executors、ScheduledThreadPoolExecutor
  11. fork/join:ForkJoinPool、ForkJoinTask、ForkJoinWorkerThread等

Except for the first base class, sun.misc.Unsafe, everything else comes from the java.util.concurrent package and its subpackages. 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326077657&siteId=291194637