@InterfaceAudience.Private class RegionNormalizerWorkQueue<E> extends Object
RegionNormalizerWorker
. It is an
ordered collection class that has the following properties:
Set
.Queue
, via take()
.BlockingQueue
.Modifier and Type | Field and Description |
---|---|
private LinkedHashSet<E> |
delegate
Underlying storage structure that gives us the Set behavior and FIFO retrieval policy.
|
private ReentrantReadWriteLock |
lock
Lock for puts and takes
|
private Condition |
notEmpty
Wait queue for waiting takes
|
Constructor and Description |
---|
RegionNormalizerWorkQueue() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Atomically removes all of the elements from this queue.
|
void |
put(E e)
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 |
putFirst(E e)
Inserts the specified element at the head of the queue.
|
int |
size()
Returns the number of elements in this queue.
|
E |
take()
Retrieves and removes the head of this queue, waiting if necessary until an element becomes
available.
|
String |
toString() |
private LinkedHashSet<E> delegate
private final ReentrantReadWriteLock lock
RegionNormalizerWorkQueue()
public void put(E e)
e
- the element to addpublic void putFirst(E e)
e
- the element to addpublic void putAll(Collection<? extends E> c)
c
- the elements to addpublic void putAllFirst(Collection<? extends E> c)
c
- the elements to addpublic E take() throws InterruptedException
InterruptedException
- if interrupted while waitingpublic void clear()
public int size()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.