You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/01/24 15:16:46 UTC

[isis] 10/20: ISIS-1569: adds guard to ensure that BackgroundCommand#startedAt is always populated.

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

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 671d3e7195d6d8403d74704c0b6ce612bd9cb74e
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Jan 18 15:23:18 2018 +0000

    ISIS-1569: adds guard to ensure that BackgroundCommand#startedAt is always populated.
---
 .../services/background/BackgroundCommandExecution.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
index 6787c25..a66a194 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
@@ -123,6 +123,17 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
                 try {
                     backgroundCommand.setExecutor(Executor.BACKGROUND);
 
+                    // responsibility for setting the Command#startedAt is in the ActionInvocationFacet or
+                    // PropertySetterFacet, but tthis is run if the domain object was found.  If the domain object is
+                    // thrown then we would have a command with only completedAt, which is inconsistent.
+                    // Therefore instead we copy down from the backgroundInteraction (similar to how we populate the
+                    // completedAt at the end)
+                    final Interaction.Execution currentExecution = backgroundInteraction.getCurrentExecution();
+                    backgroundCommand.setStartedAt(
+                            currentExecution != null
+                                    ? currentExecution.getStartedAt()
+                                    : clockService.nowAsJavaSqlTimestamp());
+
                     final boolean legacy = memento.startsWith("<memento");
                     if(legacy) {
 
@@ -223,6 +234,7 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
                     }
 
                 } catch (RuntimeException e) {
+
                     // hmmm, this doesn't really make sense if >1 action
                     //
                     // in any case, the capturing of the result of the action invocation should be the

-- 
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.