Assuming events come in order from ZK (which I believe they're supposed to), then PathChildrenCache will report them in order. However, PathChildrenCache makes no guarantee of this. A deeper point, though, is that you cannot get every event from ZooKeeper. As that same wiki says, "you cannot reliably see every change that happens to a node in ZooKeeper". So, I think you'd need to reconsider your algorithm regardless.
-JZ On Sep 20, 2013, at 11:27 AM, Benjamin Jaton <[email protected]> wrote: > Some configuration is stored in ZooKeeper and we are trying to keep a local > copy on disk, updated through events. > > I think ZooKeeper guarantees some kind of ordering, especially this one: > "The order of watch events from ZooKeeper corresponds to the order of the > updates as seen by the ZooKeeper service." > Which I thought was my use case. > > Thanks, > Benjamin > > > > On Thu, Sep 19, 2013 at 4:26 PM, Eric Tschetter <[email protected]> wrote: > Can you give some more insight into what end goal you are trying to achieve? > --Eric > > > On Thursday, September 19, 2013, Eric Tschetter wrote: > Benjamin, > > That's not really possible. Also, any protocol built around requiring them > in order is most likely going to have nasty corner cases in the face of > network partitions and server failures. > > --Eric > > On Thursday, September 19, 2013, Benjamin Jaton wrote: > Hello, > > I am trying to have PathChildrenCache send me create events in the same order > the nodes were created. > Is that possible? > > Attached is a simple example where I create node0, node1, node2, etc and I > often get the notification for node2 before node1, or the like. > Note: PathChildrenCache is created with Executors.newSingleThreadExecutor(). > > Thanks! > Benjamin >
