Package org.apache.hadoop.hbase.util
Class BoundedPriorityBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
org.apache.hadoop.hbase.util.BoundedPriorityBlockingQueue<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
@Private
@Stable
public class BoundedPriorityBlockingQueue<E>
extends AbstractQueue<E>
implements BlockingQueue<E>
A generic bounded blocking Priority-Queue. The elements of the priority queue are ordered
according to the Comparator provided at queue construction time. If multiple elements have the
same priority this queue orders them in FIFO (first-in-first-out) manner. The head of this queue
is the least element with respect to the specified ordering. If multiple elements are tied for
least value, the head is the first one inserted. The queue retrieval operations poll, remove,
peek, and element access the element at the head of the queue.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ReentrantLockprivate final Conditionprivate final Conditionprivate final BoundedPriorityBlockingQueue.PriorityQueue<E> -
Constructor Summary
ConstructorsConstructorDescriptionBoundedPriorityBlockingQueue(int capacity, Comparator<? super E> comparator) Creates a PriorityQueue with the specified capacity that orders its elements according to the specified comparator. -
Method Summary
Modifier and TypeMethodDescriptionComparator<? super E>booleanintdrainTo(Collection<? super E> c) intdrainTo(Collection<? super E> c, int maxElements) iterator()booleanbooleanpeek()poll()voidintbooleanintsize()take()Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
addMethods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
-
Field Details
-
lock
-
notEmpty
-
notFull
-
queue
-
-
Constructor Details
-
BoundedPriorityBlockingQueue
Creates a PriorityQueue with the specified capacity that orders its elements according to the specified comparator.- Parameters:
capacity- the capacity of this queuecomparator- the comparator that will be used to order this priority queue
-
-
Method Details
-
offer
-
put
- Specified by:
putin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
offer
- Specified by:
offerin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
take
- Specified by:
takein interfaceBlockingQueue<E>- Throws:
InterruptedException
-
poll
-
poll
- Specified by:
pollin interfaceBlockingQueue<E>- Throws:
InterruptedException
-
peek
-
size
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-
comparator
-
remainingCapacity
- Specified by:
remainingCapacityin interfaceBlockingQueue<E>
-
remove
- Specified by:
removein interfaceBlockingQueue<E>- Specified by:
removein interfaceCollection<E>- Overrides:
removein classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceBlockingQueue<E>- Specified by:
containsin interfaceCollection<E>- Overrides:
containsin classAbstractCollection<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-
drainTo
- Specified by:
drainToin interfaceBlockingQueue<E>
-