@InterfaceAudience.Private @InterfaceStability.Stable public class BoundedPriorityBlockingQueue<E> extends AbstractQueue<E> implements BlockingQueue<E>
Modifier and Type | Class and Description |
---|---|
private static class |
BoundedPriorityBlockingQueue.PriorityQueue<E> |
Modifier and Type | Field and Description |
---|---|
private ReentrantLock |
lock |
private Condition |
notEmpty |
private Condition |
notFull |
private BoundedPriorityBlockingQueue.PriorityQueue<E> |
queue |
Constructor and Description |
---|
BoundedPriorityBlockingQueue(int capacity,
Comparator<? super E> comparator)
Creates a PriorityQueue with the specified capacity that orders its
elements according to the specified comparator.
|
Modifier and Type | Method and Description |
---|---|
Comparator<? super E> |
comparator() |
boolean |
contains(Object o) |
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
Iterator<E> |
iterator() |
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
E |
peek() |
E |
poll() |
E |
poll(long timeout,
TimeUnit unit) |
void |
put(E e) |
int |
remainingCapacity() |
boolean |
remove(Object o) |
int |
size() |
E |
take() |
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
private final ReentrantLock lock
private final BoundedPriorityBlockingQueue.PriorityQueue<E> queue
public BoundedPriorityBlockingQueue(int capacity, Comparator<? super E> comparator)
capacity
- the capacity of this queuecomparator
- the comparator that will be used to order this priority queuepublic void put(E e) throws InterruptedException
put
in interface BlockingQueue<E>
InterruptedException
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer
in interface BlockingQueue<E>
InterruptedException
public E take() throws InterruptedException
take
in interface BlockingQueue<E>
InterruptedException
public E poll(long timeout, TimeUnit unit) throws InterruptedException
poll
in interface BlockingQueue<E>
InterruptedException
public int size()
size
in interface Collection<E>
size
in class AbstractCollection<E>
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public Comparator<? super E> comparator()
public int remainingCapacity()
remainingCapacity
in interface BlockingQueue<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface BlockingQueue<E>
remove
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface BlockingQueue<E>
contains
in class AbstractCollection<E>
public int drainTo(Collection<? super E> c)
drainTo
in interface BlockingQueue<E>
public int drainTo(Collection<? super E> c, int maxElements)
drainTo
in interface BlockingQueue<E>
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.