Skip to content

Commit 8e7117b

Browse files
committed
Change where MergedListener validates and sets notificationStep, so we don't report spurious double-notifies if a notification runs after destroy caused a prior notification to be skipped
1 parent 8e4cb20 commit 8e7117b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

engine/table/src/main/java/io/deephaven/engine/table/impl/MergedListener.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,15 @@ public void run() {
341341
+ System.identityHashCode(MergedListener.this) + ": queuedNotificationStep="
342342
+ lastEnqueuedStep + ", step=" + currentStep);
343343
}
344+
synchronized (MergedListener.this) {
345+
if (notificationStep == lastEnqueuedStep) {
346+
// noinspection ConstantConditions
347+
throw Assert.statementNeverExecuted("Multiple notifications in the same step: listener="
348+
+ System.identityHashCode(MergedListener.this) + ", queuedNotificationStep="
349+
+ lastEnqueuedStep);
350+
}
351+
notificationStep = lastEnqueuedStep;
352+
}
344353
// Retain a reference during update processing to prevent interference from concurrent destroys
345354
if (!tryRetainReference()) {
346355
// This listener is no longer live, there's no point to doing any work for this notification
@@ -384,15 +393,6 @@ private void runInternal(final long currentStep) {
384393
entry.onUpdateStart(added, removed, modified, shifted);
385394
}
386395
try {
387-
synchronized (MergedListener.this) {
388-
if (notificationStep == lastEnqueuedStep) {
389-
// noinspection ConstantConditions
390-
throw Assert.statementNeverExecuted("Multiple notifications in the same step: listener="
391-
+ System.identityHashCode(MergedListener.this) + ", queuedNotificationStep="
392-
+ lastEnqueuedStep);
393-
}
394-
notificationStep = lastEnqueuedStep;
395-
}
396396
process();
397397
getUpdateGraph().logDependencies()
398398
.append("MergedListener has completed execution ")

0 commit comments

Comments
 (0)