diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-31 02:01:37 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-07-31 02:01:37 +0000 |
commit | 0f7ea2884eb1563a7ddec2b76939bce8e8b001e5 (patch) | |
tree | 114393d4e5d2038fad6bfb6f263a533d47a928c8 /java/sca | |
parent | 12b7cae9bf154e509f3769404f090ce15d1e3b77 (diff) |
Release resources when the OSGi runtime is shutdown to remove the needs of shutdown hooks
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@799487 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
2 files changed, 16 insertions, 4 deletions
diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java index 7d331aa6c8..eb1e1a27aa 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java @@ -84,7 +84,15 @@ public class TuscanyListenerManager extends ListenerManager { public synchronized void stop() throws AxisFault { super.stop(); - Runtime.getRuntime().removeShutdownHook(shutdownThread); + try { + if (shutdownThread != null) { + Runtime.getRuntime().removeShutdownHook(shutdownThread); + shutdownThread = null; + } + } catch (IllegalStateException e) { + // Ignore + shutdownThread = null; + } } static class ListenerManagerShutdownThread extends Thread { diff --git a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java index 10667a3509..2684bcc2ae 100644 --- a/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java +++ b/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/impl/NodeActivator.java @@ -88,16 +88,20 @@ public class NodeActivator implements BundleActivator, SynchronousBundleListener public void stop(BundleContext context) throws Exception { context.removeBundleListener(this); - bundleContext = null; controller.stop(); controller = null; -// exporter.stop(); -// exporter = null; + discoveryActivator.stop(context); discoveryActivator = null; remoteAdmin.stop(); remoteAdmin = null; + + manager.stop(); + bundleContext.removeBundleListener(manager); + manager = null; + bundleContext = null; + inited = false; } public static BundleContext getBundleContext() { |