tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1513049 - in /tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi: CdiAppContextsService.java ThreadSingletonService.java ThreadSingletonServiceImpl.java
Date Mon, 12 Aug 2013 06:40:27 GMT
Author: rmannibucau
Date: Mon Aug 12 06:40:26 2013
New Revision: 1513049

URL: http://svn.apache.org/r1513049
Log:
TOMEE-1019 reading openejb.session-context later since Warmup class prevents it to be read
from SystemInstance consistently (system.properties case)

Modified:
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java?rev=1513049&r1=1513048&r2=1513049&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiAppContextsService.java
Mon Aug 12 06:40:26 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.openejb.cdi;
 
+import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.util.LogCategory;
 import org.apache.openejb.util.Logger;
 import org.apache.webbeans.config.OWBLogConst;
@@ -342,7 +343,7 @@ public class CdiAppContextsService exten
     }
 
     private SessionContext newSessionContext(final HttpSession session) {
-        final String classname = ThreadSingletonServiceImpl.sessionContextClass();
+        final String classname = SystemInstance.get().getComponent(ThreadSingletonService.class).sessionContextClass();
         if (classname != null) {
             try {
                 final Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass(classname);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java?rev=1513049&r1=1513048&r2=1513049&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
Mon Aug 12 06:40:26 2013
@@ -28,5 +28,5 @@ public interface ThreadSingletonService 
     void initialize(StartupObject startupObject);
     Object contextEntered(WebBeansContext newOWBContext);
     void contextExited(Object oldOWBContext);
-    
+    String sessionContextClass();
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java?rev=1513049&r1=1513048&r2=1513049&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
(original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
Mon Aug 12 06:40:26 2013
@@ -58,7 +58,7 @@ public class ThreadSingletonServiceImpl 
 
     public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, ThreadSingletonServiceImpl.class);
 
-    private static final String SESSION_CONTEXT_CLAZZ = SystemInstance.get().getProperty("openejb.session-context",
null);
+    private final String sessionContextClass;
 
     //this needs to be static because OWB won't tell us what the existing SingletonService
is and you can't set it twice.
     private static final ThreadLocal<WebBeansContext> contexts = new ThreadLocal<WebBeansContext>();
@@ -66,7 +66,7 @@ public class ThreadSingletonServiceImpl 
     private static final String WEBBEANS_FAILOVER_ISSUPPORTFAILOVER = "org.apache.webbeans.web.failover.issupportfailover";
 
     public ThreadSingletonServiceImpl() {
-        // no-op
+        sessionContextClass = SystemInstance.get().getProperty("openejb.session-context",
"").trim();
     }
 
     @Override
@@ -105,7 +105,7 @@ public class ThreadSingletonServiceImpl 
             properties.setProperty("org.apache.webbeans.proxy.mapping.javax.enterprise.context.RequestScoped",
NormalScopedBeanInterceptorHandler.class.getName());
         }
 
-        if (SESSION_CONTEXT_CLAZZ != null && tomee) {
+        if (sessionContextClass() != null && tomee) {
             properties.setProperty("org.apache.webbeans.proxy.mapping.javax.enterprise.context.SessionScoped",
"org.apache.tomee.catalina.cdi.SessionNormalScopeBeanHandler");
         }
 
@@ -325,12 +325,13 @@ public class ThreadSingletonServiceImpl 
         ctx.clear();
     }
 
-    public static String sessionContextClass() {
-        if (SESSION_CONTEXT_CLAZZ != null) {
-            if ("http".equals(SESSION_CONTEXT_CLAZZ)) { // easy way to manage this config
+    @Override
+    public String sessionContextClass() {
+        if (!sessionContextClass.isEmpty()) {
+            if ("http".equals(sessionContextClass)) { // easy way to manage this config
                 return "org.apache.tomee.catalina.cdi.SessionContextBackedByHttpSession";
             }
-            return SESSION_CONTEXT_CLAZZ;
+            return sessionContextClass;
         }
         return null;
     }



Mime
View raw message