并发类容器

CopyOnWrite容器

适用于 * 读多写少 *

ConcurrentMap

BlockingQueue

\begin{cases} ArrayBlockingQueue:有界阻塞,基于数组\\ LinkedBlockingQueue:无界阻塞,基于链表,读写分离\\ PriorityBlockingQueue:无界阻塞,基于优先级,元素需实现Comparable接口,内部公平锁\\ DelayQueue:无界,内部元素需实现Delayed接口\\ SynchronousQueue:无缓冲,生产者消费者 \end{cases}

DelayQueue:其中的元素只有当其指定的延迟时间到了,才能被取出,其应用场景很多,如对缓存超时的数据进行移除,任务的超时处理,空闲连接关闭等。

ConcurrentLinkedQueue

无界队列,适用于高并发,无锁,性能好于BlockingQueue,元素不允许为null

方法

你可能感兴趣的:(并发类容器)