You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2016/01/28 04:25:02 UTC

[3/3] camel git commit: CAMEL-9543 - Discovering new type converters in OSGi wipes out those manually added

CAMEL-9543 - Discovering new type converters in OSGi wipes out those manually added


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/508c1dfa
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/508c1dfa
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/508c1dfa

Branch: refs/heads/camel-2.15.x
Commit: 508c1dfabfced364e021af6b7969e9eda35448d4
Parents: cb67fe9
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Wed Jan 27 23:53:45 2016 -0330
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Wed Jan 27 23:54:27 2016 -0330

----------------------------------------------------------------------
 .../apache/camel/core/osgi/OsgiTypeConverter.java  | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/508c1dfa/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
index 00f3349..b6d5f8c 100644
--- a/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
+++ b/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiTypeConverter.java
@@ -59,19 +59,8 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
     }
 
     public Object addingService(ServiceReference<TypeConverterLoader> serviceReference) {
-        LOG.trace("AddingService: {}", serviceReference);
+        LOG.trace("AddingService: {}, Bundle: {}", serviceReference, serviceReference.getBundle());        
         TypeConverterLoader loader = bundleContext.getService(serviceReference);
-        // just make sure we don't load the bundle converter this time
-        if (delegate != null) {
-            try {
-                ServiceHelper.stopService(this.delegate);
-            } catch (Exception e) {
-                // ignore
-                LOG.debug("Error stopping service due: " + e.getMessage() + ". This exception will be ignored.", e);
-            }
-            // It can force camel to reload the type converter again
-            this.delegate = null;
-        }
         return loader;
     }
 
@@ -79,7 +68,7 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
     }
 
     public void removedService(ServiceReference<TypeConverterLoader> serviceReference, Object o) {
-        LOG.trace("RemovedService: {}", serviceReference);
+        LOG.trace("RemovedService: {}, Bundle: {}", serviceReference, serviceReference.getBundle());  
         try {
             ServiceHelper.stopService(this.delegate);
         } catch (Exception e) {
@@ -88,6 +77,8 @@ public class OsgiTypeConverter extends ServiceSupport implements TypeConverter,
         }
         // It can force camel to reload the type converter again
         this.delegate = null;
+        
+        // TODO: reloading all type converters when one service is removed is suboptimal...
     }
 
     @Override