You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/03/06 11:17:41 UTC

[causeway] 01/01: CAUSEWAY-3366: fixes error in CommandExecutorServiceDefault ... it needs to set the publishing phase explicitly before each CommandSubscriber callback

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3366
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 7ed2002befe0c141de139cc220b783943d517ae6
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Mar 6 11:17:16 2023 +0000

    CAUSEWAY-3366: fixes error in CommandExecutorServiceDefault ... it needs to set the publishing phase explicitly before each CommandSubscriber callback
---
 .../runtimeservices/command/CommandExecutorServiceDefault.java |  2 ++
 .../runtimeservices/session/InteractionServiceDefault.java     | 10 ++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
index abdd130dc3..eda62c2d21 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/command/CommandExecutorServiceDefault.java
@@ -127,12 +127,14 @@ public class CommandExecutorServiceDefault implements CommandExecutorService {
 
 
         // notify subscribers that the command is now ready for execution
+        command.updater().setPublishingPhase(Command.CommandPublishingPhase.READY);
         commandPublisherProvider.get().ready(command);
 
 
         // start executing
         val startedAt = clockService.getClock().nowAsJavaSqlTimestamp();
         command.updater().setStartedAt(startedAt);
+        command.updater().setPublishingPhase(Command.CommandPublishingPhase.STARTED);
         commandPublisherProvider.get().start(command);
 
 
diff --git a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
index df5ed9e31e..4d6e649cb5 100644
--- a/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/causeway/core/runtimeservices/session/InteractionServiceDefault.java
@@ -439,7 +439,7 @@ implements
         val command = interaction.getCommand();
 
         if(command.getStartedAt() != null && command.getCompletedAt() == null) {
-            // the guard is in case we're here as the result of a redirect following a previous exception;just ignore.
+            // the guard is in case we're here as the result of a redirect following a previous exception; patch up as best we can.
 
             val priorInteractionExecution = interaction.getPriorExecution();
             val completedAt =
@@ -448,16 +448,14 @@ implements
                         // copy over from the most recent (which will be the top-level) interaction
                         priorInteractionExecution.getCompletedAt()
                     :
-                        // this could arise as the result of calling SessionManagementService#nextSession within an action
+                        // this could arise as the result of calling InteractionService#nextInteraction within an action
                         // the best we can do is to use the current time
-
-                        // REVIEW: as for the interaction object, it is left somewhat high-n-dry.
-                         clockService.getClock().nowAsJavaSqlTimestamp();
+                        clockService.getClock().nowAsJavaSqlTimestamp();
 
             command.updater().setCompletedAt(completedAt);
-            command.updater().setPublishingPhase(Command.CommandPublishingPhase.COMPLETED);
         }
 
+        command.updater().setPublishingPhase(Command.CommandPublishingPhase.COMPLETED);
         commandPublisherProvider.get().complete(command);
 
         interaction.clear();