public class DiscardingBlockingQueue<E> extends ArrayBlockingQueue<E> implements DiscardingBlockingQueueMBean
| Constructor and Description |
|---|
DiscardingBlockingQueue(int capacity)
Creates a
DiscardingBlockingQueue with the given (fixed)
capacity and default access policy. |
DiscardingBlockingQueue(int capacity,
boolean fair)
Creates a
DiscardingBlockingQueue with the given (fixed)
capacity and the specified access policy. |
DiscardingBlockingQueue(int capacity,
boolean fair,
Collection<? extends E> c)
Creates an
DiscardingBlockingQueue with the given (fixed)
capacity, the specified access policy and initially containing the
elements of the given collection,
added in traversal order of the collection's iterator. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Add the given element to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
boolean |
addAll(Collection<? extends E> c)
Offer the given elements to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
protected void |
discardingOffer(E e)
Offer the given element to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
int |
getDiscardedElementCount() |
boolean |
offer(E e)
Offer the given element to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
boolean |
offer(E e,
long timeout,
TimeUnit unit)
Offer the given element to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
void |
put(E e)
Add the given element to the BlockingQueue
removing elements if necessary (ie if the queue is full).
|
clear, contains, drainTo, drainTo, iterator, peek, poll, poll, remainingCapacity, remove, size, spliterator, take, toArray, toArray, toStringelement, removecontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic DiscardingBlockingQueue(int capacity)
DiscardingBlockingQueue with the given (fixed)
capacity and default access policy.capacity - the capacity of this queueIllegalArgumentException - if capacity < 1public DiscardingBlockingQueue(int capacity,
boolean fair)
DiscardingBlockingQueue with the given (fixed)
capacity and the specified access policy.capacity - the capacity of this queuefair - if true then queue accesses for threads blocked
on insertion or removal, are processed in FIFO order;
if false the access order is unspecified.IllegalArgumentException - if capacity < 1public DiscardingBlockingQueue(int capacity,
boolean fair,
Collection<? extends E> c)
DiscardingBlockingQueue with the given (fixed)
capacity, the specified access policy and initially containing the
elements of the given collection,
added in traversal order of the collection's iterator.capacity - the capacity of this queuefair - if true then queue accesses for threads blocked
on insertion or removal, are processed in FIFO order;
if false the access order is unspecified.c - the collection of elements to initially containIllegalArgumentException - if capacity is less than
c.size(), or less than 1.NullPointerException - if the specified collection or anyprotected void discardingOffer(E e)
e - the element to add to the queuepublic boolean add(E e)
add in interface Collection<E>add in interface BlockingQueue<E>add in interface Queue<E>add in class ArrayBlockingQueue<E>e - the element to add to the queuepublic boolean offer(E e)
offer in interface BlockingQueue<E>offer in interface Queue<E>offer in class ArrayBlockingQueue<E>e - the element to add to the queuepublic void put(E e) throws InterruptedException
put in interface BlockingQueue<E>put in class ArrayBlockingQueue<E>e - the element to add to the queueInterruptedExceptionpublic boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer in interface BlockingQueue<E>offer in class ArrayBlockingQueue<E>e - the element to add to the queueInterruptedExceptionpublic boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>addAll in class AbstractQueue<E>c - the element to add to the queuepublic int getDiscardedElementCount()
getDiscardedElementCount in interface DiscardingBlockingQueueMBeanCopyright © 2017. All Rights Reserved.