You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/04/11 18:10:17 UTC

camel git commit: CAMEL-8617: Only stop vertx if we created it

Repository: camel
Updated Branches:
  refs/heads/master 1ea580dab -> cc4367851


CAMEL-8617: Only stop vertx if we created it


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

Branch: refs/heads/master
Commit: cc436785128714c2c147fd0e3fc4f13eb30c26e8
Parents: 1ea580d
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Apr 11 18:13:05 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Apr 11 18:13:05 2015 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/vertx/VertxComponent.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cc436785/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
index 0e82c52..8b2352a 100644
--- a/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
+++ b/components/camel-vertx/src/main/java/org/apache/camel/component/vertx/VertxComponent.java
@@ -38,6 +38,7 @@ import org.vertx.java.core.VertxFactory;
  */
 public class VertxComponent extends UriEndpointComponent implements EndpointCompleter {
     private static final Logger LOG = LoggerFactory.getLogger(VertxComponent.class);
+    private volatile boolean createdVertx;
     private Vertx vertx;
     private String host;
     private int port;
@@ -103,8 +104,11 @@ public class VertxComponent extends UriEndpointComponent implements EndpointComp
     protected void doStart() throws Exception {
         super.doStart();
 
-
         if (vertx == null) {
+
+            // we are creating vertx so we should handle its lifecycle
+            createdVertx = true;
+
             final CountDownLatch latch = new CountDownLatch(1);
 
             // lets using a host / port if a host name is specified
@@ -147,7 +151,7 @@ public class VertxComponent extends UriEndpointComponent implements EndpointComp
     protected void doStop() throws Exception {
         super.doStop();
 
-        if (vertx != null) {
+        if (createdVertx && vertx != null) {
             LOG.info("Stopping Vertx {}", vertx);
             vertx.stop();
         }