You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/10/25 09:04:55 UTC

[isis] branch master updated: ISIS-3262: interaction service: don't ignore flush exceptions

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

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 2173692ed5 ISIS-3262: interaction service: don't ignore flush exceptions
2173692ed5 is described below

commit 2173692ed59b2e8f4e429227085d62b038fea272
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Oct 25 11:04:46 2022 +0200

    ISIS-3262: interaction service: don't ignore flush exceptions
---
 .../runtimeservices/session/InteractionServiceDefault.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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 429b1bd78e..7a75891927 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
@@ -376,10 +376,12 @@ implements
     private void preInteractionClosed(final CausewayInteraction interaction) {
         completeAndPublishCurrentCommand();
 
+        RuntimeException flushException = null;
         try {
             transactionServiceProvider.get().flushTransaction();
-        } catch (Exception e) {
-            //[ISIS-3262] if flush fails just ignore, proceed with closing ...
+        } catch (RuntimeException e) {
+            //[ISIS-3262] if flush fails rethrow later, when interaction was closed ...
+            flushException = e;
         }
 
         val isSynchronizationActive = TransactionSynchronizationManager.isSynchronizationActive();
@@ -389,6 +391,10 @@ implements
         interactionScopeLifecycleHandler.onTopLevelInteractionPreDestroy(); // cleanup the InteractionScope (Spring scope)
         interactionScopeLifecycleHandler.onTopLevelInteractionClosed(); // cleanup the InteractionScope (Spring scope)
         interaction.close(); // do this last
+
+        if(flushException!=null) {
+            throw flushException;
+        }
     }
 
     private void closeInteractionLayerStackDownToStackSize(final int downToStackSize) {