2019年8月6日

Queue 队列总结

摘要: LinkedList 实现了双向队列 Deque,LinkedList允许添加null元素PriorityQueue 有优先级的无界队列ConcurrentLinkedQueue 底层是链表 线程安全的 ArrayBlockingQueue 底层是数组 有公平策略/非公平策略的有界的阻塞队列Link 阅读全文

posted @ 2019-08-06 12:17 李笑白 阅读(89) 评论(0) 推荐(0)

Queue 阻塞队列 SynchronousQueue

摘要: package com.dh.learn.queue; import java.util.concurrent.SynchronousQueue; // SynchronousQueue put/take 操作必须匹配,否则线程等待,直到与当前操作匹配的操作出现 // SynchronousQueue 没有容量,即存即取。可指定fair,为true时底层用Queue实现(先进先出),为fa... 阅读全文

posted @ 2019-08-06 12:06 李笑白 阅读(114) 评论(0) 推荐(0)

Queue 阻塞队列 DelayQueue

摘要: package com.dh.learn.queue; import java.util.concurrent.DelayQueue; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; public class LearnDelayQueue { // DelayQueue 只能放置实... 阅读全文

posted @ 2019-08-06 12:03 李笑白 阅读(102) 评论(0) 推荐(0)

导航