java核心-多线程(2)-Java多线程编程涉及到包、类
Java有关多线程编程设计的类主要涉及两个包java.lang和java.util.concurrent两个包
java.lang包,主要是线程基础类
<1>Thread
<2>Runnable
<3>ThreadLocal
java.util包,主要是线程基础类和并发工具类
<1>基础线程类
Callable、Future、FutureTask
<2>容器类(线程安全)
ArrayBlockQueue
LinkedBlockQueue
SynchronousQueue
PriorityBlockingQueue
DelayQueue
ConcurrentHashMap
CopyOnWriteArrayList
CopyOnWriteArraySet
<3>锁类(java.util.concurrent.locks)
Condition
Lock
ReentrantLock, ReentrantReadWriteLock.ReadLock, ReentrantReadWriteLock.WriteLock
ReadWriteLock
ReentrantReadWriteLock
<4>原子类(java.util.concurrent.atomic)
AtomicBoolean
AtomicInteger
AtomicLong
<5>多线程控制类
线程池:(接口)Executor 、ExecutorService (类)ThreadPoolExecutor、 ScheduledThreadPoolExecutor
线程池工具类: Executors
并发控制器:Semaphore(信号量)、CountDownLatch(倒数闩)、CyclicBarrier(同步屏障)、Exchanger(交换机)