Class HeapPriorityQueue<T extends HeapPriorityQueue.HeapPriorityQueueElement>
java.lang.Object
org.apache.flink.streaming.runtime.watermarkstatus.HeapPriorityQueue<T>
- Type Parameters:
T- type of the contained elements.
This class has similar functions with
HeapPriorityQueue. It is introduced as the replacement of
HeapPriorityQueue to be used in StatusWatermarkValve, to avoid affecting the performance of memory state backend.
The reason why the performance of memory state backend will be affected if we reuse the HeapPriorityQueue: In some scenarios, the HeapPriorityQueueElement will only have one
implementation(used by memory state backend), which allows the jvm to inline its
methods(getInternalIndex, setInternalIndex). If we reuse it in StatusWatermarkValve, it
will cause it to have multiple implementations. Once there are multiple implementations, its
methods will be difficult to be inlined by jvm, which will result in poor performance of memory
state backend.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for objects that can be managed by aHeapPriorityQueue.static interfaceThis interface works similar toComparableand is used to prioritize between two objects. -
Constructor Summary
ConstructorsConstructorDescriptionHeapPriorityQueue(HeapPriorityQueue.PriorityComparator<T> elementPriorityComparator, int minimumCapacity) Creates an emptyHeapPriorityQueuewith the requested initial capacity. -
Method Summary
-
Constructor Details
-
HeapPriorityQueue
public HeapPriorityQueue(@Nonnull HeapPriorityQueue.PriorityComparator<T> elementPriorityComparator, @Nonnegative int minimumCapacity) Creates an emptyHeapPriorityQueuewith the requested initial capacity.- Parameters:
elementPriorityComparator- comparator for the priority of contained elements.minimumCapacity- the minimum and initial capacity of this priority queue.
-
-
Method Details
-
adjustModifiedElement
-
poll
-
peek
-
add
-
remove
-
isEmpty
public boolean isEmpty() -
size
public int size() -
clear
public void clear()Clears the queue.
-