I don't think this should be possible (if it happens it's a bug in zk).
Perhaps, for some reason, there really are 2 change actions (children
created, or the same child created twice) and not just one?
Re-registering the watch "inside the watch" is fine. The server sends
watch notifications as one way messages, when it notices a znode child
list has changed it fires off change messages to all the registered
clients. The client then receives the notification and calls the handler.
Patrick
On 06/15/2010 05:47 PM, Jun Rao wrote:
> Hi,
>
> I get a quick question on ZK 3.2.2. Here is a sequence of events during a
> test:
> 1. client 1 creates an ephemeral node under /a
> 2. client 1 sets a watch using getChildren on /a
> 3. client 2 creates an ephemeral node under /a
> 4. client 1's watch gets triggered (a node change event). Inside the watch,
> client 1 does getChildren on /a and sets the watch.
> 5. client 1's watch gets triggered again (a node change event)
>
> My question is why the same node change event gets triggered twice. It seems
> that step 5 shouldn't have happened.
>
> Thanks,
>
> Jun
>
|