Class HeapPriorityQueue<T extends org.apache.flink.streaming.runtime.watermarkstatus.HeapPriorityQueue.HeapPriorityQueueElement>
- java.lang.Object
-
- org.apache.flink.streaming.runtime.watermarkstatus.HeapPriorityQueue<T>
-
- Type Parameters:
T- type of the contained elements.
public class HeapPriorityQueue<T extends org.apache.flink.streaming.runtime.watermarkstatus.HeapPriorityQueue.HeapPriorityQueueElement> extends Object
This class has similar functions withHeapPriorityQueue. It is introduced as the replacement ofHeapPriorityQueueto be used inStatusWatermarkValve, 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, theHeapPriorityQueueElementwill only have one implementation(used by memory state backend), which allows the jvm to inline its methods(getInternalIndex, setInternalIndex). If we reuse it inStatusWatermarkValve, 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.
-
-
Constructor Summary
Constructors Constructor Description HeapPriorityQueue(org.apache.flink.streaming.runtime.watermarkstatus.HeapPriorityQueue.PriorityComparator<T> elementPriorityComparator, int minimumCapacity)Creates an emptyHeapPriorityQueuewith the requested initial capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T toAdd)voidadjustModifiedElement(T element)voidclear()Clears the queue.booleanisEmpty()Tpeek()Tpoll()booleanremove(T toRemove)intsize()
-
-
-
Constructor Detail
-
HeapPriorityQueue
public HeapPriorityQueue(@Nonnull org.apache.flink.streaming.runtime.watermarkstatus.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.
-
-