In ZooKeeper, can I use async getData () for a non existing znode?

Even I called the exists () method, I should also check Code.NoNode.

So you can directly use the getData () method?

I notice that sync getData () will throw an exception if node does not exist. So, do I get any performance penalty or another aspect if I call async getData on a non-existing znode?

Thanks!

+4
source share
1 answer

If you want to get the contents of znode, you should use getData instead of using the existing one and then getData.

Because in any case, you need to check Code.NoNode after receiving a response from getData. So why not name it directly?

+1
source

All Articles