geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1148178 - in /geronimo/server/trunk: framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/ plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/
Date Tue, 19 Jul 2011 05:29:37 GMT
Author: xuhaihong
Date: Tue Jul 19 05:29:36 2011
New Revision: 1148178

URL: http://svn.apache.org/viewvc?rev=1148178&view=rev
Log:
GERONIMO-6043 module init order doesn't always work due to gbean dependencies

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java?rev=1148178&r1=1148177&r2=1148178&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/basic/BasicLifecycleMonitor.java
Tue Jul 19 05:29:36 2011
@@ -17,33 +17,34 @@
 
 package org.apache.geronimo.kernel.basic;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.LinkedHashSet;
-import java.util.ArrayList;
-import java.util.Collection;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.lifecycle.LifecycleMonitor;
-import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
-import org.apache.geronimo.gbean.runtime.LifecycleBroadcaster;
-import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.runtime.LifecycleBroadcaster;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
+import org.apache.geronimo.kernel.lifecycle.LifecycleMonitor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @version $Rev$ $Date$
  */
 public class BasicLifecycleMonitor implements LifecycleMonitor {
     private static final Logger log = LoggerFactory.getLogger(BasicLifecycleMonitor.class);
-    
+
     // todo we should only hold weak references to the listeners
     /**
      * Map of AbstractName to set of Listeners interested in this name.
@@ -53,7 +54,7 @@ public class BasicLifecycleMonitor imple
     /**
      * Map of listener to patterns they are interested in.
      */
-    private final Map listenerPatterns = new HashMap();
+    private final Map listenerPatterns = new LinkedHashMap();
 
     public BasicLifecycleMonitor(Kernel kernel) {
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=1148178&r1=1148177&r2=1148178&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
Tue Jul 19 05:29:36 2011
@@ -692,7 +692,9 @@ public class EARConfigBuilder implements
             appContexts.setAttribute("globalContextSegment", applicationInfo.getJndiContext().get(JndiScope.global));
             appContexts.setAttribute("applicationContextMap", applicationInfo.getJndiContext().get(JndiScope.app));
             appContexts.setReferencePattern("GlobalContext", globalContextAbstractName);
-            earContext.addGBean(appContexts);
+            if (!initModulesInDDOrder) {
+                earContext.addGBean(appContexts);
+            }
 
             // add gbeans declared in the geronimo-application.xml
             if (geronimoApplication != null) {
@@ -762,6 +764,16 @@ public class EARConfigBuilder implements
                 }
             }
 
+            for(Module<?, ?> module : modules) {
+                module.flushGBeansToContext();
+            }
+
+            //ApplicationJndi is added as the last GBean, as it is a common dependency GBean
by each EJB GBean and web module GBean
+            //With doing this, it  makes the modules in the ear are started in order, while
init-order is configured.
+            if (initModulesInDDOrder) {
+                earContext.addGBean(appContexts);
+            }
+
             if (createPlanMode.get()) {
                 EARConfigBuilder.appInfo.set(applicationInfo);
                 throw new DeploymentException();

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java?rev=1148178&r1=1148177&r2=1148178&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/Module.java
Tue Jul 19 05:29:36 2011
@@ -217,6 +217,7 @@ public abstract class Module<T, U> {
         for (GBeanData data: gbeans.values()) {
             earContext.addGBean(data);
         }
+        gbeans.clear();
     }
 
     public int hashCode() {



Mime
View raw message