Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/5414#discussion_r166017493
--- Diff:
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/SharedBuffer.java
---
@@ -437,72 +425,63 @@ public void add(final ValueTimeWrapper<V> valueTime,
final SharedBufferEntry<K,
/**
* Removes all entries from the map whose timestamp is smaller
than the pruning timestamp.
- *
* @param pruningTimestamp Timestamp for the pruning
+ * @param prunedEntries a {@link Set} to put the removed {@link
SharedBufferEntry SharedBufferEntries}.
*/
- public void prune(long pruningTimestamp,
List<SharedBufferEntry<K, V>> prunedEntries) {
- Iterator<Map.Entry<ValueTimeWrapper<V>,
SharedBufferEntry<K, V>>> iterator = entries.entrySet().iterator();
- boolean continuePruning = true;
-
- while (iterator.hasNext() && continuePruning) {
- SharedBufferEntry<K, V> entry =
iterator.next().getValue();
-
+ private void prune(final long pruningTimestamp, final
List<SharedBufferEntry<K, V>> prunedEntries) {
+ Iterator<Map.Entry<ValueTimeWrapper<V>,
SharedBufferEntry<K, V>>> it = entries.entrySet().iterator();
+ while (it.hasNext()) {
+ SharedBufferEntry<K, V> entry =
it.next().getValue();
if (entry.getValueTime().getTimestamp() <=
pruningTimestamp) {
prunedEntries.add(entry);
- iterator.remove();
- } else {
- continuePruning = false;
+ it.remove();
--- End diff --
was the early cancel not working before? Or: why was `continuePruning`
removed.
---