Ah we usually keep track on the endpoint number of active users with onProducerStarted / onProducerStopped etc. then we can just stop it when the counter hit zero
On Fri, Dec 20, 2013 at 12:41 PM, Willem Jiang <willem.ji...@gmail.com> wrote: > Hi Claus, > > You are right, we may hit this kind of issue if the endpoint is shared by > different consumer or producer. > > The ZooKeeperManager is bind to endpoint, we should stop it when the endpoint > is stopped. > I will updated the code for it. > > -- > Willem Jiang > > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > On December 20, 2013 at 7:33:31 PM, Claus Ibsen (claus.ib...@gmail.com) wrote: >> >> Hi >> >> Is there a problem if you have 2 camel routes using the same zookeeper >> endpoint, and each route have their own zookeeper producer. >> And now >> you shutdown one of the routes, so the other route is still running. >> >> If the producer now stops a shared zkm, then the running routes >> will fail. >> >> Just wondering if we now have such a problem? >> >> On Fri, Dec 20, 2013 at 12:30 PM, wrote: >> > Updated Branches: >> > refs/heads/master fdb19f5d1 -> ab39bdab3 >> > >> > >> > ZooKeeperProducer should shutdown the ConnectionManager >> when it is closed with thanks to Klaus >> > >> > >> > Project: http://git-wip-us.apache.org/repos/asf/camel/repo >> > Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5c184f93 >> > Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5c184f93 >> > Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5c184f93 >> > >> > Branch: refs/heads/master >> > Commit: 5c184f93dea63c8eddc78088a7c074ff1ea2b5bd >> > Parents: fdb19f5 >> > Author: Willem Jiang >> > Authored: Fri Dec 20 19:26:02 2013 +0800 >> > Committer: Willem Jiang >> > Committed: Fri Dec 20 19:26:02 2013 +0800 >> > >> > ---------------------------------------------------------------------- >> > .../apache/camel/component/zookeeper/ZookeeperProducer.java >> | 9 +++++++++ >> > 1 file changed, 9 insertions(+) >> > ---------------------------------------------------------------------- >> > >> > >> > http://git-wip-us.apache.org/repos/asf/camel/blob/5c184f93/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java >> > ---------------------------------------------------------------------- >> > diff --git >> > a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java >> b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java >> > index 4edc98e..f3e77d9 100644 >> > --- >> > a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java >> > +++ >> > b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZookeeperProducer.java >> > @@ -101,6 +101,15 @@ public class ZookeeperProducer extends >> DefaultProducer { >> > } >> > } >> > >> > + @Override >> > + protected void doStop() throws Exception { >> > + super.doStop(); >> > + if (log.isTraceEnabled()) { >> > + log.trace(String.format("Shutting down zookeeper producer >> of '%s'", configuration.getPath())); >> > + } >> > + zkm.shutdown(); >> > + } >> > + >> > private void asynchronouslyDeleteNode(ZooKeeper connection, >> ProductionContext context) { >> > if (log.isDebugEnabled()) { >> > log.debug(format("Deleting node '%s', not waiting for confirmation", >> context.node)); >> > >> >> >> >> -- >> Claus Ibsen >> ----------------- >> Red Hat, Inc. >> Email: cib...@redhat.com >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> Make your Camel applications look hawt, try: http://hawt.io >> > -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io