前言

上文【从入门到放弃-Java】并发编程-JUC- edBlockingQueue,我们介绍了基于链表的有界阻塞队列 edBlockingQueue,它是Executors.newFixedThreadPool中workQueue使用的阻塞队列。
本文我们来学习ExecutorService.newCachedThreadPool中使用的阻塞队列:SynchronousQueue。

SynchronousQueue


如图和 edBlockingQueue一样,都是继承了AbstractQueue类,实现了BlockingQueue和Serializable接口

SynchronousQueue

/** * Creates a {@code SynchronousQueue} with nonfair access po
收藏 打印