geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r1305391 - 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 Mon, 26 Mar 2012 15:20:55 GMT
Author: xiaming
Date: Mon Mar 26 15:20:55 2012
New Revision: 1305391

URL: http://svn.apache.org/viewvc?rev=1305391&view=rev
Log:
GERONIMO-5802 1. Only fail start when service module is failed 2. log missing dependency,
for 2.1 branch

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=1305391&r1=1305390&r2=1305391&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
Mon Mar 26 15:20:55 2012
@@ -499,7 +499,13 @@ public class SimpleConfigurationManager 
         List<Dependency> dependencies = new ArrayList<Dependency>(environment.getDependencies());
         for (ListIterator<Dependency> iterator = dependencies.listIterator(); iterator.hasNext();)
{
             Dependency dependency = iterator.next();
-            Artifact resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
+            Artifact resolvedArtifact = null;
+            try {
+                resolvedArtifact = artifactResolver.resolveInClassLoader(dependency.getArtifact());
+            } catch (MissingDependencyException e) {
+                log.error("Cannot resolve dependency " + dependency.getArtifact() + " for
configuration " + configurationData.getId());
+                throw e;
+            }
             if (isConfiguration(resolvedArtifact)) {
                 parentIds.add(resolvedArtifact);
 
@@ -660,7 +666,7 @@ public class SimpleConfigurationManager 
             // try to start the configuation
             try {
                 Configuration configuration = getConfiguration(configurationId);
-		applyOverrides(configuration);
+        applyOverrides(configuration);
                 monitor.starting(configurationId);
                 start(configuration);
                 monitor.succeeded(configurationId);
@@ -1354,11 +1360,11 @@ public class SimpleConfigurationManager 
      * @throws InvalidConfigException
      */
     private void applyOverrides(Configuration configuration) throws InvalidConfigException{
-    	ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader();
+        ClassLoader configurationClassLoader = configuration.getConfigurationClassLoader();
         Collection<GBeanData> gbeans = configuration.getConfigurationData().getGBeans(configurationClassLoader);
         if (configuration.getManageableAttributeStore() != null) {
-        	configuration.getManageableAttributeStore().applyOverrides(configuration.getId(),
gbeans, 
-        			configurationClassLoader);
+            configuration.getManageableAttributeStore().applyOverrides(configuration.getId(),
gbeans, 
+                    configurationClassLoader);
         }
     }
 

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=1305391&r1=1305390&r2=1305391&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
Mon Mar 26 15:20:55 2012
@@ -38,6 +38,7 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.DebugLoggingLifecycleMonitor;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
@@ -171,10 +172,10 @@ public class EmbeddedDaemon implements M
             monitor.systemStarted(kernel);
 
             AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
+            Set<AbstractName> configLists = kernel.listGBeans(query);
 
             if (configs.isEmpty()) {
-                // --override wasn't used (nothing explicit), see what was running before
-                Set<AbstractName> configLists = kernel.listGBeans(query);
+                // --override wasn't used (nothing explicit), see what was running before
               
                 for (AbstractName configListName : configLists) {
                     try {
                         configs.addAll((List<Artifact>) kernel.invoke(configListName,
"restore"));
@@ -201,14 +202,32 @@ public class EmbeddedDaemon implements M
                         for (Artifact configID : sorted) {
                             monitor.moduleLoading(configID);
                             configurationManager.loadConfiguration(configID, lifecycleMonitor);
+                            int configModuleType = configurationManager.getConfiguration(configID).getModuleType().getValue();
                             monitor.moduleLoaded(configID);
-                            monitor.moduleStarting(configID);
-                            configurationManager.startConfiguration(configID, lifecycleMonitor);
-                            monitor.moduleStarted(configID);
+                            try {
+                                monitor.moduleStarting(configID);
+                                configurationManager.startConfiguration(configID, lifecycleMonitor);
+                                monitor.moduleStarted(configID);
+                            } catch (Exception e) {
+                                if ( configModuleType != ConfigurationModuleType.SERVICE.getValue()
) {
+                                    log.warn("Failed to start module " + configID + "; Cause
by " + e.getCause());
+                                    configurationManager.unloadConfiguration(configID);
+                                    continue;
+                                }
+                            }
                         }
                     } while (unloadedConfigsCount > unloadedConfigs.size());
                     if (!unloadedConfigs.isEmpty()) {
-                        throw new InvalidConfigException("Could not locate configs to start:
" + unloadedConfigs);
+                        // GERONIMO-5802 Not simply fail server when unloadedConfigs is not
empty, thus, server could
+                        // start in most cases as long as the system modules are started
OK.
+                        // throw new InvalidConfigException("Could not locate configs to
start: " + unloadedConfigs);
+                        for (Artifact configID:unloadedConfigs) {
+                            for (AbstractName configListName : configLists) {
+                                kernel.invoke(configListName, "stopConfiguration", new Object[]{configID},
new String[]{Artifact.class.getName()});
+                            }
+                            
+                        }
+                        log.warn("Could not start configs: " + unloadedConfigs);
                     }
                     // the server has finished loading the persistent configuration so inform
the gbean
                     AbstractNameQuery startedQuery = new AbstractNameQuery(ServerStatus.class.getName());
@@ -230,7 +249,7 @@ public class EmbeddedDaemon implements M
             }
 
             // Tell every persistent configuration list that the kernel is now fully started
-            Set<AbstractName> configLists = kernel.listGBeans(query);
+            configLists = kernel.listGBeans(query);
             for (AbstractName configListName : configLists) {
                 kernel.setAttribute(configListName, "kernelFullyStarted", Boolean.TRUE);
             }



Mime
View raw message