Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # user >> question about lock recipe and watchers


Copy link to this message
-
Re: question about lock recipe and watchers
Hi Phil,

On Fri, Sep 14, 2012 at 6:23 PM, Phil Carns <[EMAIL PROTECTED]> wrote:
> What happens to the watcher in this case?  Is there any way to cancel a
> watcher, or is there an alternative way to accomplish the intent of the lock
> recipe algorithm without using an exists() watcher?

Right now the API doesn't provide a way to cancel watches, so the
watches will remain active until the session is closed.

https://issues.apache.org/jira/browse/ZOOKEEPER-442

You could set the watch using get() instead of exists(). These watches
get set if and only if the znode exists, and they get triggered when
the znode goes away.

--Michi