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
