为了避免队列元素过多,你也可以为它设置一个最大值。
In order to keep the queue from growing too large, a Max capacity can be set.
清单10. web . xml中指定JMS连接工厂和队列的元素。
Listing 10. Elements in web.xml specifying JMS connection factory and queue.
显示从队列中取出元素的两次调用之间的时间差。
The time delta is displayed between successive calls to get elements from the queue.
后两个方法element和peek用于在队列的头部查询元素。
The last two methods, element and peek , are for querying the element at the head of the queue.
这个改变引入一些索引,允许对大的重传队列中的元素进行随机访问,这个改变对于解决TCP协议栈的find - first攻击问题很重要。
A change that introduces some sort of index that allows access to random elements of the large retransmission queue is critical to address the find-first attacks against the TCP stack.
用队列中的一个元素来表示其工作单位的任务。
A task whose unit of work is represented by an element in a queue.
不是立即从队列中添加或者删除元素,线程执行操作阻塞,直到有空间或者元素可用。
Instead of adding and removing elements from the queue immediately, the thread performing the operation blocks until space or an element is available.
PriorityBlockingQueue是具有无界限容量的队列,它利用所包含元素的Comparable排序顺序来以逻辑顺序维护元素。
PriorityBlockingQueue is a queue with an unbound capacity that maintains elements in their logical order through use of the Comparable sort order of the contained elements.
不仅能添加和删除元素,还能查看队列中有哪些元素。
Not only do you add and remove elements, you can also look at the queue to see what is there. Listing 5 shows the five methods of the queue interface.
不过在队列为空时,它就会从其它线程的队列中“窃取”一些元素。
However, if its queue is empty then it will steal items from another thread's queue.
当这个消费者出现时,这个元素就直接在消费者和生产者之间传递,永远不会加入到阻塞队列中。
When that consumer is available, the element is passed directly between consumer and producer, never literally getting added to the blocking queue.
当这个消费者出现时,这个元素就直接在消费者和生产者之间传递,永远不会加入到阻塞队列中。
When that consumer is available, the element is passed directly between consumer and producer, never literally getting added to the blocking queue.
应用推荐