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 071eec2a55 ISIS-3262: ignore flush exceptions when closing the
interaction stack
071eec2a55 is described below
commit 071eec2a55f623e0c9e97c25d067525011c45c0c
Author: Andi Huber <[email protected]>
AuthorDate: Tue Oct 25 09:19:51 2022 +0200
ISIS-3262: ignore flush exceptions when closing the interaction stack
---
.../session/InteractionServiceDefault.java | 46 ++++++++++++----------
1 file changed, 25 insertions(+), 21 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 e6503c7880..98ae99315b 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
@@ -32,6 +32,19 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
+import org.apache.causeway.applib.annotation.PriorityPrecedence;
+import org.apache.causeway.applib.services.clock.ClockService;
+import org.apache.causeway.applib.services.iactn.Interaction;
+import org.apache.causeway.applib.services.iactnlayer.InteractionContext;
+import org.apache.causeway.applib.services.iactnlayer.InteractionLayer;
+import org.apache.causeway.applib.services.iactnlayer.InteractionLayerTracker;
+import org.apache.causeway.applib.services.iactnlayer.InteractionService;
+import org.apache.causeway.applib.services.inject.ServiceInjector;
+import org.apache.causeway.applib.services.xactn.TransactionService;
+import org.apache.causeway.applib.util.schema.ChangesDtoUtils;
+import org.apache.causeway.applib.util.schema.CommandDtoUtils;
+import org.apache.causeway.applib.util.schema.InteractionDtoUtils;
+import org.apache.causeway.applib.util.schema.InteractionsDtoUtils;
import org.apache.causeway.commons.functional.ThrowingRunnable;
import org.apache.causeway.commons.internal.base._Casts;
import org.apache.causeway.commons.internal.concurrent._ConcurrentContext;
@@ -44,6 +57,11 @@ import
org.apache.causeway.core.interaction.scope.InteractionScopeBeanFactoryPos
import
org.apache.causeway.core.interaction.scope.InteractionScopeLifecycleHandler;
import org.apache.causeway.core.interaction.scope.TransactionBoundaryAware;
import org.apache.causeway.core.interaction.session.CausewayInteraction;
+import org.apache.causeway.core.metamodel.services.publishing.CommandPublisher;
+import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
+import org.apache.causeway.core.runtime.events.MetamodelEventService;
+import
org.apache.causeway.core.runtimeservices.CausewayModuleCoreRuntimeServices;
+import
org.apache.causeway.core.security.authentication.InteractionContextFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Lazy;
@@ -52,26 +70,6 @@ import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import
org.springframework.transaction.support.TransactionSynchronizationManager;
-import org.apache.causeway.applib.annotation.PriorityPrecedence;
-import org.apache.causeway.applib.services.clock.ClockService;
-import org.apache.causeway.applib.services.iactn.Interaction;
-import org.apache.causeway.applib.services.iactnlayer.InteractionContext;
-import org.apache.causeway.applib.services.iactnlayer.InteractionLayer;
-import org.apache.causeway.applib.services.iactnlayer.InteractionLayerTracker;
-import org.apache.causeway.applib.services.iactnlayer.InteractionService;
-import org.apache.causeway.applib.services.inject.ServiceInjector;
-import org.apache.causeway.applib.services.xactn.TransactionService;
-import org.apache.causeway.applib.util.schema.ChangesDtoUtils;
-import org.apache.causeway.applib.util.schema.CommandDtoUtils;
-import org.apache.causeway.applib.util.schema.InteractionDtoUtils;
-import org.apache.causeway.applib.util.schema.InteractionsDtoUtils;
-
-import org.apache.causeway.core.metamodel.services.publishing.CommandPublisher;
-import org.apache.causeway.core.metamodel.specloader.SpecificationLoader;
-import org.apache.causeway.core.runtime.events.MetamodelEventService;
-import
org.apache.causeway.core.runtimeservices.CausewayModuleCoreRuntimeServices;
-import
org.apache.causeway.core.security.authentication.InteractionContextFactory;
-
import lombok.NonNull;
import lombok.SneakyThrows;
import lombok.val;
@@ -376,7 +374,13 @@ implements
private void preInteractionClosed(final CausewayInteraction interaction) {
completeAndPublishCurrentCommand();
- transactionServiceProvider.get().flushTransaction();
+
+ try {
+ transactionServiceProvider.get().flushTransaction();
+ } catch (Exception e) {
+ //[ISIS-3262] if flush fails just ignore, proceed with closing ...
+ }
+
val isSynchronizationActive =
TransactionSynchronizationManager.isSynchronizationActive();
transactionBoundaryAwareBeans.forEach(bean->bean.beforeLeavingTransactionalBoundary(interaction,
isSynchronizationActive));
txBoundaryHandler.onClose(interaction);