摘要: 什么是可重入锁? ReentrantLock是可重入锁,什么是可重入锁呢?可重入锁就是当前持有该锁的线程能够多次获取该锁,无需等待。可重入锁是如何实现的呢?这要从ReentrantLock的一个内部类Sync的父类说起,Sync的父类是AbstractQueuedSynchronizer(后面简称A 阅读全文
posted @ 2019-01-24 17:30 He_quotes 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 一、Condition的概念 介绍 回忆 synchronized 关键字,它配合 Object 的 wait()、notify() 系列方法可以实现等待/通知模式。 对于 Lock,通过 Condition 也可以实现等待/通知模式。 Condition 是一个接口。Condition 接口的实现 阅读全文
posted @ 2019-01-24 15:23 He_quotes 阅读(145) 评论(0) 推荐(0) 编辑