摘要: 服务端原本有个定时任务对一个集合ArrayList 中的消息做处理。 因为考虑到处理消息是先进先出原则,所以优化的时候考虑改用ConcurrentLinkedQueue 当时没仔细深入研究过这个集合就匆匆上线了。结果刚上线第二天就出问题了。服务端一次优化演变成了一个缺陷,还好及时回退了版本,后果才不 阅读全文
posted @ 2018-10-17 09:17 brave-sailor 阅读(1214) 评论(0) 推荐(0)
摘要: LinkedBlockingQueue 的API中,从队列中获取元素,有以下几个方法:1、take():原文:Retrieves and removes the head of this queue, waiting if necessary until an element becomes ava 阅读全文
posted @ 2018-10-17 09:13 brave-sailor 阅读(252) 评论(0) 推荐(0)
摘要: import java.util.concurrent.ConcurrentLinkedQueue; public class CacheTest { /** * * offer(E e) 将指定元素插入此队列的尾部。 * poll() 获取并移除此队列的头,如果此队列为空,则返回 null。 * 阅读全文
posted @ 2018-10-17 09:11 brave-sailor 阅读(2545) 评论(0) 推荐(0)