diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-29 00:54:28 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-29 00:54:28 +0000 |
commit | 7099b4adb5fb2a93d285ef8ab34decfa27c42e7c (patch) | |
tree | 0ca776af0a63072233dff0938aa9b6ffee484baa /java/sca/modules | |
parent | 7a63300029ab165e86be6fc33984def1a44e3fc5 (diff) |
Ignore errors when stop
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@830813 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r-- | java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java index 51cb58f3b3..470d681555 100644 --- a/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java +++ b/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java @@ -24,6 +24,8 @@ import java.util.Hashtable; import java.util.IdentityHashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.LifeCycleListener; @@ -39,6 +41,7 @@ import org.osgi.framework.ServiceRegistration; * */ public class OSGiExtensionPointRegistry extends DefaultExtensionPointRegistry { + private static final Logger logger = Logger.getLogger(OSGiExtensionPointRegistry.class.getName()); private Map<Class<?>, ServiceRegistration> services = new ConcurrentHashMap<Class<?>, ServiceRegistration>(); private BundleContext bundleContext; @@ -107,18 +110,26 @@ public class OSGiExtensionPointRegistry extends DefaultExtensionPointRegistry { // Get a unique map as an extension point may exist in the map by different keys Map<LifeCycleListener, LifeCycleListener> map = new IdentityHashMap<LifeCycleListener, LifeCycleListener>(); for (ServiceRegistration reg : services.values()) { - ServiceReference ref = reg.getReference(); - if (ref != null) { - Object service = bundleContext.getService(ref); - if (service instanceof LifeCycleListener) { - LifeCycleListener activator = (LifeCycleListener)service; - map.put(activator, activator); + try { + ServiceReference ref = reg.getReference(); + if (ref != null) { + Object service = bundleContext.getService(ref); + if (service instanceof LifeCycleListener) { + LifeCycleListener activator = (LifeCycleListener)service; + map.put(activator, activator); + } + reg.unregister(); } - reg.unregister(); + } catch (Throwable e) { + logger.log(Level.WARNING, e.getMessage(), e); } } for (LifeCycleListener activator : map.values()) { - activator.stop(); + try { + activator.stop(); + } catch (Throwable e) { + logger.log(Level.WARNING, e.getMessage(), e); + } } services.clear(); } |