摘要:
使用示例: SynchronousQueue的put和take是阻塞的,一个线程put,然后阻塞,等待另一个线程take;或者一个线程take,然后阻塞,等待另一个线程put。 阻塞线程: 唤醒线程: Executors.newCachedThreadPool使用的队列是SynchronousQue 阅读全文
posted @ 2018-01-15 18:11
偶尔发呆
阅读(729)
评论(0)
推荐(1)
摘要:
Executors 类对 ThreadPoolExecutor 的构造函数进行了封装,使用该类可方便地创建线程池。 1. newFixedThreadPool 2. newCachedThreadPool 分析任务入队和出队,分别对应 ThreadPoolExecutor 类的 execute 方法 阅读全文
posted @ 2018-01-15 16:04
偶尔发呆
阅读(442)
评论(0)
推荐(0)