You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2020/12/05 12:49:17 UTC

[karaf] branch master updated: Minor Camel example fix

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new d4d125f  Minor Camel example fix
d4d125f is described below

commit d4d125f7010b30ba9232595776bb66734df6e668
Author: jbonofre <jb...@apache.org>
AuthorDate: Sat Dec 5 13:49:01 2020 +0100

    Minor Camel example fix
---
 .../java/org/apache/karaf/examples/camel/java/CamelComponent.java    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/examples/karaf-camel-example/karaf-camel-example-java/src/main/java/org/apache/karaf/examples/camel/java/CamelComponent.java b/examples/karaf-camel-example/karaf-camel-example-java/src/main/java/org/apache/karaf/examples/camel/java/CamelComponent.java
index 4fd9556..ca2c5e8 100644
--- a/examples/karaf-camel-example/karaf-camel-example-java/src/main/java/org/apache/karaf/examples/camel/java/CamelComponent.java
+++ b/examples/karaf-camel-example/karaf-camel-example-java/src/main/java/org/apache/karaf/examples/camel/java/CamelComponent.java
@@ -35,13 +35,12 @@ import java.util.ArrayList;
 )
 public class CamelComponent {
 
-    private BundleContext bundleContext;
     private ModelCamelContext camelContext;
     private ServiceRegistration<CamelContext> serviceRegistration;
 
     @Activate
     public void activate(ComponentContext componentContext) throws Exception {
-        bundleContext = componentContext.getBundleContext();
+        BundleContext bundleContext = componentContext.getBundleContext();
         camelContext = new OsgiDefaultCamelContext(bundleContext);
         serviceRegistration = bundleContext.registerService(CamelContext.class, camelContext, null);
         camelContext.start();
@@ -96,7 +95,7 @@ public class CamelComponent {
     public void deactivate() throws Exception {
         camelContext.stop();
         camelContext.removeRouteDefinitions(new ArrayList<RouteDefinition>(camelContext.getRouteDefinitions()));
-        bundleContext.ungetService(serviceRegistration.getReference());
+        serviceRegistration.unregister();
     }
 
 }