摘要: Future 使用 Future 的使用: 使用线程池创建 Future 对象 ExecutorService executorService = Executors.newSingleThreadExecutor(); Future future = executorService.submit( 阅读全文
posted @ 2021-11-26 18:56 唯学而知 阅读(268) 评论(0) 推荐(0) 编辑
摘要: ReentrantLock 简介 ReentrantLock也是一个可重入的互斥锁,跟 synchronized 提供一样的线程同步功能,但是比 synchronized 更加灵活,优化了 synchronized 的不足。 ReentrantLock 基于 AQS 实现,它使用一个内部类来实现 A 阅读全文
posted @ 2021-11-26 15:25 唯学而知 阅读(48) 评论(0) 推荐(0) 编辑