You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by st...@apache.org on 2015/05/06 11:13:53 UTC

[12/25] tomee git commit: back to the original session.invalidate() for now since CDI tcks need it and our lifecycle doesn't allow us yet to do it later

back to the original session.invalidate() for now since CDI tcks need it and our lifecycle doesn't allow us yet to do it later


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/9d182562
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/9d182562
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/9d182562

Branch: refs/heads/fb_tomee2_owb16
Commit: 9d182562bb67e02bb47395cb77b86ea88cef8014
Parents: 272cb40
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon May 4 21:08:35 2015 +0200
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon May 4 21:08:35 2015 +0200

----------------------------------------------------------------------
 .../apache/openejb/cdi/CdiAppContextsService.java    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/9d182562/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
index 02c190f..52b87f6 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
@@ -203,12 +203,19 @@ public class CdiAppContextsService extends AbstractContextsService implements Co
             final Object event = HttpSessionContextSessionAware.class.isInstance(sc) ? HttpSessionContextSessionAware.class.cast(sc).getSession() : sc;
             if (HttpSession.class.isInstance(event)) {
                 final HttpSession httpSession = HttpSession.class.cast(event);
-                if (httpSession.getId() == null) {
-                    continue;
+                if (httpSession.getId() != null) { // TODO: think if we add a flag to deactivate this behavior (clustering case??)
+                    initSessionContext(httpSession);
+                    try {
+                        // far to be sexy but we need 1) triggering listeners + 2) destroying it *now*
+                        // -> org.jboss.cdi.tck.tests.context.session.listener.shutdown.SessionContextListenerShutdownTest
+                        httpSession.invalidate();
+                    } finally {
+                        destroySessionContext(event);
+                    }
                 }
-                initSessionContext(httpSession);
+            } else {
+                destroySessionContext(event);
             }
-            destroySessionContext(event);
         }
         sessionCtxManager.getContextById().clear();
     }