It turns out that this is tricky to solve. When the server you're connected to goes down, you get a Watcher.Event.KeeperState.Disconnected. However, it could be that you are able to reconnect to another server so the disconnected event should be ignored. My solution is to watch for Watcher.Event.KeeperState.Disconnected and then execute a sync() (using the currently configured retry policy). If that sync fails, Curator will call the unhandledError() method of the LeaderSelectorListener. This seems like the best way to handle this. Thoughts?
As an aside, as part of working on this I now have a TestingCluster class that will create, in memory, n ZooKeeper servers in an ensemble. This could be useful to everyone :) -JZ On 11/14/11 3:25 AM, "Jérémie BORDIER" <[email protected]> wrote: >I'd be really happy to >contribute as we plan on using Curator, but I think this may impact >all the recipes so you're probably the best person to link these bits >together.
