tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1500597 - in /tomee/tomee/trunk/server/openejb-ejbd/src: main/java/org/apache/openejb/server/ejbd/EjbDaemon.java main/java/org/apache/openejb/server/ejbd/EjbServer.java test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
Date Mon, 08 Jul 2013 07:58:00 GMT
Author: rmannibucau
Date: Mon Jul  8 07:58:00 2013
New Revision: 1500597

URL: http://svn.apache.org/r1500597
Log:
TOMEE-994 EjbDaemon shouldn't be a singleton + add name in properties passed to init the EjbDaemon

Modified:
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
    tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
    tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java?rev=1500597&r1=1500596&r2=1500597&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbDaemon.java
Mon Jul  8 07:58:00 2013
@@ -61,22 +61,10 @@ public class EjbDaemon implements org.ap
     private AuthRequestHandler authHandler;
     private ClusterRequestHandler clusterHandler;
 
-    static EjbDaemon instance;
-
     private ContainerSystem containerSystem;
     private boolean gzip;
     private EJBDSerializer serializer = null;
 
-    private EjbDaemon() {
-    }
-
-    public static EjbDaemon getEjbDaemon() {
-        if (instance == null) {
-            instance = new EjbDaemon();
-        }
-        return instance;
-    }
-
     public void init(final Properties props) throws Exception {
         containerSystem = SystemInstance.get().getComponent(ContainerSystem.class);
         //        deploymentIndex = new DeploymentIndex(containerSystem.deployments());
@@ -98,8 +86,6 @@ public class EjbDaemon implements org.ap
             } catch (final NoClassDefFoundError cnfe) { // let's try later with app classloader
                 this.serializer = new ContextualSerializer(serializer);
             }
-        } else if (!"ejbds".equals(props.getProperty("name", "ejbds")) && !"httpejbd".equals(props.getProperty("name",
"ejbd"))) {
-            this.serializer = null;
         }
 
         final DiscoveryAgent discovery = SystemInstance.get().getComponent(DiscoveryAgent.class);

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java?rev=1500597&r1=1500596&r2=1500597&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java
Mon Jul  8 07:58:00 2013
@@ -42,7 +42,10 @@ public class EjbServer implements org.ap
 
     @Override
     public void init(final Properties props) throws Exception {
-        server = EjbDaemon.getEjbDaemon();
+        server = new EjbDaemon();
+        if (props.getProperty("name") == null) { // to let server be component aware
+            props.setProperty("name", getName());
+        }
         server.init(props);
         keepAlive = new KeepAliveServer(this, server.isGzip());
     }

Modified: tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java?rev=1500597&r1=1500596&r2=1500597&view=diff
==============================================================================
--- tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
(original)
+++ tomee/tomee/trunk/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
Mon Jul  8 07:58:00 2013
@@ -22,9 +22,14 @@ import org.apache.openejb.jee.Enterprise
 import org.apache.openejb.jee.SingletonBean;
 import org.apache.openejb.junit.ApplicationComposer;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.server.ServerService;
+import org.apache.openejb.server.ServiceDaemon;
+import org.apache.openejb.server.ServiceManager;
+import org.apache.openejb.server.SimpleServiceManager;
 import org.apache.openejb.testing.Configuration;
 import org.apache.openejb.testing.EnableServices;
 import org.apache.openejb.testing.Module;
+import org.apache.openejb.util.reflection.Reflections;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -53,7 +58,14 @@ public class ZEjbdTest {
 
     @Test
     public void checkZipIsOn() throws Exception {
-        assertTrue(EjbDaemon.getEjbDaemon().isGzip());
+        int checked = 0;
+        for (final ServerService daemon : SimpleServiceManager.class.cast(ServiceManager.get()).getDaemons())
{
+            if (ServiceDaemon.class.isInstance(daemon) && daemon.getName().equals("ejbd"))
{
+                assertTrue(EjbDaemon.class.cast(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(Reflections.get(daemon,
"next"), "service"), "service"), "service"), "service"), "service"), "server")).isGzip());
+                checked++;
+            }
+        }
+        assertEquals(1, checked);
     }
 
     @Test



Mime
View raw message