curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zhang Xiaoyu <zhangxiaoyu...@gmail.com>
Subject does children's data is always guarantee included in the watcher event ?
Date Wed, 10 Jun 2015 00:36:14 GMT
Hi, guys,
I am trying to use PathChildrenCache to set up a watcher on a ZK path, so
when any children is added to the path, I will get a watcher event.

My client logic is in the watcher event, do getData().getData() to get the
children's data. This is working for me. The question is can I always relay
on this or should I have a backup option if data is a empty byte[], I still
retrieval data based on child's path ?

My logic in watcher event is:

if (data.length != 0) {
    //do the following logic
} else {
    byte[] data = client.getData().forPatch(childPath);
    // do the following logic
}

do I need the else block ? Let me know if need more code explanation.

Thanks,
Johnny

Mime
View raw message