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 2021/07/06 12:36:09 UTC

[isis] 04/11: ISIS-2789: fixing compile issues in InteractionScopeHACK

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

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

commit 9c44106ed648e21667263a48493178a653edd522
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Jul 6 08:34:25 2021 +0100

    ISIS-2789: fixing compile issues in InteractionScopeHACK
---
 .../isis/core/interaction/scope/InteractionScopeHACK.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/core/interaction/src/main/java/org/apache/isis/core/interaction/scope/InteractionScopeHACK.java b/core/interaction/src/main/java/org/apache/isis/core/interaction/scope/InteractionScopeHACK.java
index 4b5d39e..3a3c590 100644
--- a/core/interaction/src/main/java/org/apache/isis/core/interaction/scope/InteractionScopeHACK.java
+++ b/core/interaction/src/main/java/org/apache/isis/core/interaction/scope/InteractionScopeHACK.java
@@ -156,7 +156,7 @@ class InteractionScopeHACK implements Scope, InteractionScopeLifecycleHandler {
     }
 
     @Override
-    public void onTopLevelInteractionClosing() {
+    public void onTopLevelInteractionPreDestroy() {
         ensureInteractionLayerTrackerInjected();
         iInteractionLayerTracker.currentInteraction()
                 .ifPresent(interaction -> {
@@ -167,6 +167,19 @@ class InteractionScopeHACK implements Scope, InteractionScopeLifecycleHandler {
                     val scopedObjectValues = scopedObjects.values();
                     scopedObjectValues.forEach(ScopedObject::preDestroy);
                     scopedObjects.clear();
+                });
+    }
+
+    @Override
+    public void onTopLevelInteractionClosed() {
+        ensureInteractionLayerTrackerInjected();
+        iInteractionLayerTracker.currentInteraction()
+                .ifPresent(interaction -> {
+                    final ScopedObjects scopedObjects = interaction.getAttribute(ScopedObjects.class);
+                    if (scopedObjects == null) {
+                        return;
+                    }
+                    scopedObjects.clear();
                     interaction.removeAttribute(ScopedObjects.class);
                 });
     }