You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/10/15 19:41:07 UTC

svn commit: r825582 - /geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java

Author: djencks
Date: Thu Oct 15 17:41:07 2009
New Revision: 825582

URL: http://svn.apache.org/viewvc?rev=825582&view=rev
Log:
make server restart, but see GERONIMO-4909

Modified:
    geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java

Modified: geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java?rev=825582&r1=825581&r2=825582&view=diff
==============================================================================
--- geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java (original)
+++ geronimo/sandbox/djencks/osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/osgi/ConfigurationActivator.java Thu Oct 15 17:41:07 2009
@@ -30,8 +30,12 @@
 import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.InternalKernelException;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev$ $Date$
@@ -64,8 +68,33 @@
         ServiceReference kernelReference = bundleContext.getServiceReference(Kernel.class.getName());
         if (kernelReference != null) {
             Kernel kernel = (Kernel) bundleContext.getService(kernelReference);
-            ConfigurationManager manager = ConfigurationUtil.getConfigurationManager(kernel);
-            manager.unloadConfiguration(id);
+            AbstractName name = Configuration.getConfigurationAbstractName(id);
+            //TODO investigate how this is called and whether just stopping/unloading the configuration gbean will
+            //leave the configuration model in a consistent state.  We might need a shutdown flag set elsewhere to avoid
+            //overwriting the load attribute in config.xml. This code mimics the shutdown hook in KernelConfigurationManager
+            //see https://issues.apache.org/jira/browse/GERONIMO-4909
+            try {
+                kernel.stopGBean(name);
+            } catch (GBeanNotFoundException e) {
+
+            } catch (InternalKernelException e) {
+
+            } catch (IllegalStateException e) {
+
+            }
+            try {
+                kernel.unloadGBean(name);
+            } catch (GBeanNotFoundException e) {
+
+            } catch (InternalKernelException e) {
+
+            } catch (IllegalStateException e) {
+
+            }
+            //TODO this code is more symmetrical with start, but currently sets the load attribute to false in config.xml,
+            //which prevents restarting the server.
+//            ConfigurationManager manager = ConfigurationUtil.getConfigurationManager(kernel);
+//            manager.unloadConfiguration(id);
         }
     }
 }