Class RegionNormalizerWorkQueue<E>
java.lang.Object
org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<E>
A specialized collection that holds pending work for the
RegionNormalizerWorker
. It is an
ordered collection class that has the following properties:
- Guarantees uniqueness of elements, as a
Set
. - Consumers retrieve objects from the head, as a
Queue
, viatake()
. - Work is retrieved on a FIFO policy.
- Work retrieval blocks the calling thread until new work is available, as a
BlockingQueue
. - Allows a producer to insert an item at the head of the queue, if desired.
-
Field Summary
Modifier and TypeFieldDescriptionprivate LinkedHashSet<E>
Underlying storage structure that gives us the Set behavior and FIFO retrieval policy.private final ReentrantReadWriteLock
Lock for puts and takesprivate final Condition
Wait queue for waiting takes -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Atomically removes all of the elements from this queue.void
Inserts the specified element at the tail of the queue, if it's not already present.void
putAll
(Collection<? extends E> c) Inserts the specified elements at the tail of the queue.void
putAllFirst
(Collection<? extends E> c) Inserts the specified elements at the head of the queue.void
Inserts the specified element at the head of the queue.int
size()
Returns the number of elements in this queue.take()
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.toString()
-
Field Details
-
delegate
Underlying storage structure that gives us the Set behavior and FIFO retrieval policy. -
lock
Lock for puts and takes -
notEmpty
Wait queue for waiting takes
-
-
Constructor Details
-
RegionNormalizerWorkQueue
-
-
Method Details
-
put
Inserts the specified element at the tail of the queue, if it's not already present.- Parameters:
e
- the element to add
-
putFirst
Inserts the specified element at the head of the queue.- Parameters:
e
- the element to add
-
putAll
Inserts the specified elements at the tail of the queue. Any elements already present in the queue are ignored.- Parameters:
c
- the elements to add
-
putAllFirst
Inserts the specified elements at the head of the queue.- Parameters:
c
- the elements to add
-
take
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.- Returns:
- the head of this queue
- Throws:
InterruptedException
- if interrupted while waiting
-
clear
Atomically removes all of the elements from this queue. The queue will be empty after this call returns. -
size
Returns the number of elements in this queue.- Returns:
- the number of elements in this queue
-
toString
-