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 2011/01/28 03:28:51 UTC
svn commit: r1064432 - in /geronimo/server/trunk:
framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/
plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/
Author: djencks
Date: Fri Jan 28 02:28:51 2011
New Revision: 1064432
URL: http://svn.apache.org/viewvc?rev=1064432&view=rev
Log:
GERONIMO-5782 Avoid a deadlock undeploying an EBA application
Modified:
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java?rev=1064432&r1=1064431&r2=1064432&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/KernelConfigurationManager.java Fri Jan 28 02:28:51 2011
@@ -32,6 +32,7 @@ import org.apache.geronimo.gbean.GBeanIn
import org.apache.geronimo.gbean.GBeanInfoBuilder;
import org.apache.geronimo.gbean.GBeanLifecycle;
import org.apache.geronimo.gbean.InvalidConfigurationException;
+import org.apache.geronimo.gbean.annotation.OsgiService;
import org.apache.geronimo.gbean.annotation.ParamReference;
import org.apache.geronimo.gbean.annotation.ParamSpecial;
import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
@@ -62,6 +63,7 @@ import org.slf4j.LoggerFactory;
*/
@GBean(j2eeType = "ConfigurationManager")
+@OsgiService
public class KernelConfigurationManager extends SimpleConfigurationManager implements GBeanLifecycle {
protected final Kernel kernel;
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=1064432&r1=1064431&r2=1064432&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Fri Jan 28 02:28:51 2011
@@ -1386,28 +1386,30 @@ public class SimpleConfigurationManager
return configuration.getDependencyNode().getParents();
}
- public synchronized void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException, LifecycleException {
- if (!configurationId.isResolved()) {
- throw new IllegalArgumentException("Artifact " + configurationId + " is not fully resolved");
- }
- if (configurations.containsKey(configurationId)) {
- if (isRunning(configurationId)) {
- stopConfiguration(configurationId);
+ public void uninstallConfiguration(Artifact configurationId) throws IOException, NoSuchConfigException, LifecycleException {
+ synchronized (this) {
+ if (!configurationId.isResolved()) {
+ throw new IllegalArgumentException("Artifact " + configurationId + " is not fully resolved");
}
- if (isLoaded((configurationId))) {
- unloadConfiguration(configurationId);
+ if (configurations.containsKey(configurationId)) {
+ if (isRunning(configurationId)) {
+ stopConfiguration(configurationId);
+ }
+ if (isLoaded((configurationId))) {
+ unloadConfiguration(configurationId);
+ }
}
- }
- uninstall(configurationId);
+ uninstall(configurationId);
- for (ConfigurationStore store : getStoreList()) {
- if (store.containsConfiguration(configurationId)) {
- store.uninstall(configurationId);
+ for (ConfigurationStore store : getStoreList()) {
+ if (store.containsConfiguration(configurationId)) {
+ store.uninstall(configurationId);
+ }
}
- }
- removeConfigurationFromModel(configurationId);
+ removeConfigurationFromModel(configurationId);
+ }
notifyWatchers(configurationId);
}
Modified: geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java?rev=1064432&r1=1064431&r2=1064432&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java (original)
+++ geronimo/server/trunk/plugins/console/console-core/src/main/java/org/apache/geronimo/console/util/PortletManager.java Fri Jan 28 02:28:51 2011
@@ -59,6 +59,8 @@ import org.apache.geronimo.logging.Syste
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleReference;
+import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,6 +75,14 @@ public class PortletManager {
private final static String SERVER_KEY = "org.apache.geronimo.console.J2EEServer";
private final static String JVM_KEY = "org.apache.geronimo.console.JVM";
private final static String SYSTEM_LOG_KEY = "org.apache.geronimo.console.SystemLog";
+
+ private static BundleContext bundleContext;
+ static {
+ ClassLoader cl = PortletManager.class.getClassLoader();
+ if (cl instanceof BundleReference) {
+ bundleContext = ((BundleReference)cl).getBundle().getBundleContext();
+ }
+ }
// The following may change based on the user's selections
// nothing yet
@@ -83,6 +93,7 @@ public class PortletManager {
public static Kernel getKernel() {
//todo: consider making this configurable; we could easily connect to a remote kernel if we wanted to
+ //TODO see GERONIMO-5782 this jndi lookup can cause deadlocks
Kernel kernel = null;
try {
kernel = (Kernel) new InitialContext().lookup("java:comp/GeronimoKernel");
@@ -97,6 +108,12 @@ public class PortletManager {
}
public static ConfigurationManager getConfigurationManager() {
+ if (bundleContext != null) {
+ ServiceReference sr = bundleContext.getServiceReference(ConfigurationManager.class.getName());
+ if (sr != null) {
+ return (ConfigurationManager) bundleContext.getService(sr);
+ }
+ }
try {
return ConfigurationUtil.getConfigurationManager(getKernel());
} catch (GBeanNotFoundException e) {