ArrayBlockingQueue
来源:互联网 发布:淘宝双11秒杀技巧 编辑:程序博客网 时间:2024/05/17 09:00
The ArrayBlockingQueue
class implements the BlockingQueue
interface. Read the BlockingQueue
text for more information about the interface.
ArrayBlockingQueue
is a bounded, blocking queue that stores the elements internally in an array. That it is bounded means that it cannot store unlimited amounts of elements. There is an upper bound on the number of elements it can store at the same time. You set the upper bound at instantiation time, and after that it cannot be changed.
The ArrayBlockingQueue
stores the elements internally in FIFO (First In, First Out) order. The head
of the queue is the element which has been in queue the longest time, and the tail
of the queue is the element which has been in the queue the shortest time.
Here is how to instantiate and use an ArrayBlockingQueue
:
BlockingQueue queue = new ArrayBlockingQueue(1024);queue.put("1");Object object = queue.take();
Here is a BlockingQueue
example that uses Java Generics. Notice how you can put and take String's instead of :
BlockingQueue<String> queue = new ArrayBlockingQueue<String>(1024);queue.put("1");String string = queue.take();
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue
- ArrayBlockingQueue使用
- java ArrayBlockingQueue
- ArrayBlockingQueue解析
- ArrayBlockingQueue简介
- ArrayBlockingQueue详解
- jdk-ArrayBlockingQueue
- BlockingQueue arrayBlockingqueue
- ArrayBlockingQueue浅析
- 1508-张晨曦总结《2016年-11月-1日》【连续11天总结】
- BlockingQueue
- Redshift 性能测试(一)
- AngularJS之表格序号
- 在使用AWS时遇到的问题
- ArrayBlockingQueue
- 单片机控制继电器 使LED灯交替闪烁
- DelayQueue
- servlet几种跳转方法的路径怎么写
- hive中启动metastore
- 微信开发--如何存储并定时更新access_token
- LinkedBlockingQueue
- String中的常用方法
- 二分查找 C 、C++STL