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 2024/06/28 12:34:04 UTC

(causeway) branch CAUSEWAY-3799 updated: CAUSEWAY-3799: uses DeadlockRecognizer in the retry logic of RunBackgroundCommandsJob also

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

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


The following commit(s) were added to refs/heads/CAUSEWAY-3799 by this push:
     new 20a121aef1 CAUSEWAY-3799: uses DeadlockRecognizer in the retry logic of RunBackgroundCommandsJob also
20a121aef1 is described below

commit 20a121aef1730e1677eeab8ac7dae316fae88223
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jun 28 13:33:58 2024 +0100

    CAUSEWAY-3799: uses DeadlockRecognizer in the retry logic of RunBackgroundCommandsJob also
---
 .../extensions/commandlog/applib/job/RunBackgroundCommandsJob.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/job/RunBackgroundCommandsJob.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/job/RunBackgroundCommandsJob.java
index b1d3632fc7..5e48163727 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/job/RunBackgroundCommandsJob.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/job/RunBackgroundCommandsJob.java
@@ -30,6 +30,7 @@ import javax.inject.Inject;
 import org.apache.causeway.commons.functional.Try;
 import org.apache.causeway.core.config.CausewayConfiguration;
 import org.apache.causeway.core.interaction.session.CausewayInteraction;
+import org.apache.causeway.core.metamodel.services.deadlock.DeadlockRecognizer;
 import org.apache.causeway.core.runtimeservices.transaction.TransactionServiceSpring;
 import org.apache.causeway.extensions.commandlog.applib.dom.CommandLogEntryRepository;
 
@@ -89,6 +90,7 @@ public class RunBackgroundCommandsJob implements Job {
     @Inject CommandLogEntryRepository commandLogEntryRepository;
     @Inject CommandExecutorService commandExecutorService;
     @Inject BackgroundCommandsJobControl backgroundCommandsJobControl;
+    @Inject DeadlockRecognizer deadlockRecognizer;
 
     @Inject List<RunBackgroundCommandsJobListener> listeners;
     @Autowired private CausewayConfiguration causewayConfiguration;
@@ -273,12 +275,12 @@ public class RunBackgroundCommandsJob implements Job {
         .ifFailureFail();
     }
 
-    private static boolean isEncounteredDeadlock(Try<?> result) {
+    private boolean isEncounteredDeadlock(Try<?> result) {
         if (!result.isFailure()) {
             return false;
         }
         return result.getFailure()
-                .map(throwable -> throwable instanceof DeadlockLoserDataAccessException)
+                .map(throwable -> deadlockRecognizer.isDeadlock(throwable))
                 .orElse(false);
     }
 
@@ -289,5 +291,4 @@ public class RunBackgroundCommandsJob implements Job {
             // do nothing - continue
         }
     }
-
 }