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/29 09:21:53 UTC
[isis] 02/05: ISIS-1569: extends BackgroundCommandExecution so that
stops execution of replayable commands once at least one has failed.
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 2cf72b4314606498e4508a3f9bd5426c3b961ba5
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Jan 25 18:48:22 2018 +0000
ISIS-1569: extends BackgroundCommandExecution so that stops execution of replayable commands once at least one has failed.
---
.../services/background/BackgroundCommandExecution.java | 15 +++++++++++++++
1 file changed, 15 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 b73f165..faa0225 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
@@ -108,6 +108,8 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
final IsisTransactionManager transactionManager,
final Command backgroundCommand) {
+ final boolean replayHitException[] = new boolean[] {false};
+
transactionManager.executeWithinTransaction(
backgroundCommand,
new TransactionalClosure() {
@@ -119,6 +121,14 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
final String memento = backgroundCommand.getMemento();
+ // if this is a replayable command but we've also previously tried to execute a replayable commaand
+ // that hit an exception when executed, then just skip; we don't want to execute replayable commands
+ // after one has been blocked.
+ if(backgroundCommand.getExecuteIn().isReplayable() && replayHitException[0]) {
+ return;
+ }
+
+
try {
backgroundCommand.setExecutor(Executor.BACKGROUND);
@@ -255,6 +265,11 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
? priorExecution.getCompletedAt()
: clockService.nowAsJavaSqlTimestamp(); // close enough...
backgroundCommand.setCompletedAt(completedAt);
+
+ // prevent any further replayable exceptions from running
+ if(backgroundCommand.getExecuteIn().isReplayable()) {
+ replayHitException[0] = true;
+ }
}
private ObjectAction findObjectAction(
--
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.