J.U.C

作者: 梁行之 | 来源:发表于2017-10-13 19:35 被阅读0次

1 atomic 类

AtomicInteger
内部原理:
底层利用硬件cas实现原子的比较和修改
Unsafe.compareAndSwapInt()

2 lock 锁

Lock/Condition
Lock:volatile int state,实现锁的获取和释放,FIFO 队列完成阻塞
阻塞线程和恢复底层:Unsafe.park() 和 Unsafe.unpark()
Condition: 内部维护一个wait状态的队列

3 collections 并发集合

ConcurrentMap/BlockingQueue

4 executor

Future/Callable/Executor

5 tools 工具类

Executors/Semaphore/CountDownLatch

相关文章

网友评论

      本文标题:J.U.C

      本文链接:https://www.haomeiwen.com/subject/fuazyxtx.html