geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r661494 - in /geronimo/server/branches/2.1/framework/modules: geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Date Thu, 29 May 2008 21:41:49 GMT
Author: jbohn
Date: Thu May 29 14:41:49 2008
New Revision: 661494

URL: http://svn.apache.org/viewvc?rev=661494&view=rev
Log:
merge r661442 from trunk - GERONIMO-3993 Only load/start the available plugins, and repeat
till no progress occurs

Modified:
    geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=661494&r1=661493&r2=661494&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Thu May 29 14:41:49 2008
@@ -443,20 +443,33 @@
         }
     }
 
+    // Return ids that can be loaded in sorted order.  Remove loadable ids from source set.
     public LinkedHashSet<Artifact> sort(List<Artifact> ids, LifecycleMonitor
monitor) throws InvalidConfigException, IOException, NoSuchConfigException, MissingDependencyException
{
         LinkedHashSet<Artifact> sorted = new LinkedHashSet<Artifact>();
         sort(ids, sorted, monitor);
         sorted.retainAll(ids);
+        ids.removeAll(sorted);
         return sorted;
     }
 
     private void sort(Collection<Artifact> ids, LinkedHashSet<Artifact> sorted,
LifecycleMonitor monitor) throws InvalidConfigException, IOException, NoSuchConfigException,
MissingDependencyException {
         for (Artifact id : ids) {
             if (!sorted.contains(id)) {
-                ConfigurationData data = loadConfigurationData(id, monitor);
-                LinkedHashSet<Artifact> parents = resolveParentIds(data);
-                sort(parents, sorted, monitor);
-                sorted.add(id);
+                try {
+                    //configuration may not be loadable yet, the config-store may not be
available to load from
+                    ConfigurationData data = loadConfigurationData(id, monitor);
+                    LinkedHashSet<Artifact> parents = resolveParentIds(data);
+                    sort(parents, sorted, monitor);
+                    sorted.add(id);
+                } catch (NoSuchConfigException e) {
+                    //ignore
+                } catch (IOException e) {
+                    //ignore
+                } catch (InvalidConfigException e) {
+                    //ignore
+                } catch (MissingDependencyException e) {
+                    //ignore
+                }
             }
         }
     }

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java?rev=661494&r1=661493&r2=661494&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
(original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/main/EmbeddedDaemon.java
Thu May 29 14:41:49 2008
@@ -20,10 +20,9 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.LinkedHashSet;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -37,6 +36,7 @@
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.DebugLoggingLifecycleMonitor;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
 import org.apache.geronimo.kernel.config.LifecycleMonitor;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -58,9 +58,9 @@
     public EmbeddedDaemon(Kernel kernel) {
         this.kernel = kernel;
     }
-    
+
     public int execute(Object opaque) {
-        if (! (opaque instanceof DaemonCLParser)) {
+        if (!(opaque instanceof DaemonCLParser)) {
             throw new IllegalArgumentException("Argument type is [" + opaque.getClass() +
"]; expected [" + DaemonCLParser.class + "]");
         }
         DaemonCLParser parser = (DaemonCLParser) opaque;
@@ -71,10 +71,10 @@
 
         System.out.println("Booting Geronimo Kernel (in Java " + System.getProperty("java.version")
+ ")...");
         System.out.flush();
-        
+
         // Perform initialization tasks common with the various Geronimo environments
         GeronimoEnvironment.init();
-        
+
         monitor.systemStarting(start);
         return doStartup();
     }
@@ -100,7 +100,7 @@
         }
         lifecycleMonitor = new DebugLoggingLifecycleMonitor(log);
     }
-    
+
     protected int doStartup() {
         try {
             // Check that the tmpdir exists - if not give friendly msg and exit
@@ -108,7 +108,7 @@
             // (since 1.0 release) the same way Tomcat allows it to be configured.
             String tmpDir = System.getProperty("java.io.tmpdir");
             if (tmpDir == null || (!(new File(tmpDir)).exists()) || (!(new File(tmpDir)).isDirectory()))
{
-                System.err.println("The java.io.tmpdir system property specifies a non-existent
directory: "  + tmpDir);
+                System.err.println("The java.io.tmpdir system property specifies a non-existent
directory: " + tmpDir);
                 return 1;
             }
 
@@ -149,22 +149,29 @@
             try {
                 ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
                 try {
-                    LinkedHashSet<Artifact> sorted = configurationManager.sort(configs,
lifecycleMonitor);
-                    for (Artifact configID : sorted) {
-                        monitor.moduleLoading(configID);
-                        configurationManager.loadConfiguration(configID, lifecycleMonitor);
-                        monitor.moduleLoaded(configID);
-                        monitor.moduleStarting(configID);
-                        configurationManager.startConfiguration(configID, lifecycleMonitor);
-                        monitor.moduleStarted(configID);
+                    List<Artifact> unloadedConfigs = new ArrayList(configs);
+                    int unloadedConfigsCount;
+                    do {
+                        unloadedConfigsCount = unloadedConfigs.size();
+                        LinkedHashSet<Artifact> sorted = configurationManager.sort(unloadedConfigs,
lifecycleMonitor);
+                        for (Artifact configID : sorted) {
+                            monitor.moduleLoading(configID);
+                            configurationManager.loadConfiguration(configID, lifecycleMonitor);
+                            monitor.moduleLoaded(configID);
+                            monitor.moduleStarting(configID);
+                            configurationManager.startConfiguration(configID, lifecycleMonitor);
+                            monitor.moduleStarted(configID);
+                        }
+                    } while (unloadedConfigsCount > unloadedConfigs.size());
+                    if (!unloadedConfigs.isEmpty()) {
+                        throw new InvalidConfigException("Could not locate configs to start:
" + unloadedConfigs);
                     }
                     // the server has finished loading the persistent configuration so inform
the gbean
                     AbstractNameQuery startedQuery = new AbstractNameQuery(ServerStatus.class.getName());
-                    Set statusBeans = kernel.listGBeans(startedQuery);
-                    for(Iterator itr = statusBeans.iterator();itr.hasNext();) {
-                        AbstractName statusName = (AbstractName)itr.next();
-                        ServerStatus status = (ServerStatus)kernel.getGBean(statusName);
-                        if(status != null) {
+                    Set<AbstractName> statusBeans = kernel.listGBeans(startedQuery);
+                    for (AbstractName statusName : statusBeans) {
+                        ServerStatus status = (ServerStatus) kernel.getGBean(statusName);
+                        if (status != null) {
                             status.setServerStarted(true);
                         }
                     }
@@ -233,5 +240,5 @@
     public static GBeanInfo getGBeanInfo() {
         return GBEAN_INFO;
     }
-    
+
 }



Mime
View raw message