tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r830813 - /tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java
Date Thu, 29 Oct 2009 00:54:28 GMT
Author: rfeng
Date: Thu Oct 29 00:54:28 2009
New Revision: 830813

URL: http://svn.apache.org/viewvc?rev=830813&view=rev
Log:
Ignore errors when stop

Modified:
    tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java

Modified: tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java?rev=830813&r1=830812&r2=830813&view=diff
==============================================================================
--- tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java
(original)
+++ tuscany/java/sca/modules/extensibility-equinox/src/main/java/org/apache/tuscany/sca/extensibility/equinox/OSGiExtensionPointRegistry.java
Thu Oct 29 00:54:28 2009
@@ -24,6 +24,8 @@
 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 @@
  *
  */
 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 @@
         // 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();
     }



Mime
View raw message