From f28e9e237c87a51d34417de992f8fe3e64266faa Mon Sep 17 00:00:00 2001 From: Ryan Caudy Date: Fri, 22 Nov 2024 23:20:57 -0500 Subject: [PATCH] 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 --- .../engine/table/impl/MergedListener.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/MergedListener.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/MergedListener.java index e093dc80a9e..cb0c4d24113 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/MergedListener.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/MergedListener.java @@ -341,6 +341,15 @@ public void run() { + System.identityHashCode(MergedListener.this) + ": queuedNotificationStep=" + lastEnqueuedStep + ", step=" + currentStep); } + synchronized (MergedListener.this) { + if (notificationStep == lastEnqueuedStep) { + // noinspection ConstantConditions + throw Assert.statementNeverExecuted("Multiple notifications in the same step: listener=" + + System.identityHashCode(MergedListener.this) + ", queuedNotificationStep=" + + lastEnqueuedStep); + } + notificationStep = lastEnqueuedStep; + } // Retain a reference during update processing to prevent interference from concurrent destroys if (!tryRetainReference()) { // 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) { entry.onUpdateStart(added, removed, modified, shifted); } try { - synchronized (MergedListener.this) { - if (notificationStep == lastEnqueuedStep) { - // noinspection ConstantConditions - throw Assert.statementNeverExecuted("Multiple notifications in the same step: listener=" - + System.identityHashCode(MergedListener.this) + ", queuedNotificationStep=" - + lastEnqueuedStep); - } - notificationStep = lastEnqueuedStep; - } process(); getUpdateGraph().logDependencies() .append("MergedListener has completed execution ")