You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/08/03 23:26:53 UTC

svn commit: r428532 - /geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java

Author: ammulder
Date: Thu Aug  3 14:26:52 2006
New Revision: 428532

URL: http://svn.apache.org/viewvc?rev=428532&view=rev
Log:
Fix for ConfigurationAwareReference during a reload operation, which
  caused redeploy to fail on modules with references and no version
  number in their module ID (GERONIMO-2269)

Modified:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=428532&r1=428531&r2=428532&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Thu Aug  3 14:26:52 2006
@@ -53,6 +53,15 @@
     protected final Collection repositories;
     protected final Collection watchers;
 
+    /**
+     * When this is not null, it points to the "new" configuration that is
+     * part of an in-process reload operation.  This configuration will
+     * definitely be loaded, but might not be started yet.  It shold never be
+     * populated outside the scope of a reload operation.
+     */
+    private Configuration reloadingConfiguration;
+
+
     public SimpleConfigurationManager(Collection stores, ArtifactResolver artifactResolver, Collection repositories) {
         this(stores, artifactResolver, repositories, Collections.EMPTY_SET);
     }
@@ -86,6 +95,9 @@
         if(!configId.isResolved()) {
             throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
         }
+        if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configId)) {
+            return true;
+        }
         return configurationModel.isLoaded(configId);
     }
 
@@ -228,6 +240,9 @@
         if(!configurationId.isResolved()) {
             throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
         }
+        if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configurationId)) {
+            return reloadingConfiguration;
+        }
         return (Configuration) configurations.get(configurationId);
     }
 
@@ -769,11 +784,11 @@
         }
     }
 
-    public LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws LifecycleException, NoSuchConfigException {
+    public synchronized LifecycleResults reloadConfiguration(ConfigurationData configurationData) throws LifecycleException, NoSuchConfigException {
         return reloadConfiguration(configurationData, NullLifecycleMonitor.INSTANCE);
     }
 
-    public LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws LifecycleException, NoSuchConfigException {
+    public synchronized LifecycleResults reloadConfiguration(ConfigurationData configurationData, LifecycleMonitor monitor) throws LifecycleException, NoSuchConfigException {
         Configuration configuration = getConfiguration(configurationData.getId());
         if (configuration == null) {
             throw new NoSuchConfigException(configurationData.getId());
@@ -942,6 +957,7 @@
 
                     if (configurationId.equals(newConfigurationId)) {
                         newConfiguration = configuration;
+                        reloadingConfiguration = configuration;
                     } else {
                         loadedParents.put(configurationId, configuration);
                     }
@@ -1049,7 +1065,7 @@
                     configuration = load(existingUnloadedConfiguration.getConfigurationData(),
                             existingUnloadedConfiguration.getResolvedParentIds(),
                             Collections.EMPTY_MAP);
-
+                    reloadingConfiguration = configuration;
                     // if the configuration was started before restart it
                     if (started.contains(existingConfigurationId)) {
                         start(configuration);
@@ -1081,6 +1097,8 @@
 
                     throw new LifecycleException("reload", newConfigurationId, results);
                 }
+            } finally {
+                reloadingConfiguration = null;
             }
         }
 
@@ -1113,6 +1131,7 @@
                 if (resolvedParentIds != null) {
                     monitor.loading(configurationId);
                     configuration = load(unloadedConfiguration.getConfigurationData(), resolvedParentIds, Collections.EMPTY_MAP);
+                    reloadingConfiguration = configuration;
                     monitor.succeeded(configurationId);
 
 
@@ -1163,6 +1182,8 @@
 
                     skip.add(failedId);
                 }
+            } finally {
+                reloadingConfiguration = null;
             }
         }