Java – in zookeeper, can I use async GetData () on a znode that doesn’t exist?
•
Java
Even if I call the exists () method, I should check the code NoNode.
So can I use the GetData () method directly?
I noticed that synchronization GetData () throws an exception if the node does not exist So if I call asynchronous GetData on a znode that doesn't exist, will I get any performance or other penalties?
thank you!
Solution
If you want to get the content of znode, you should use GetData instead of exists and then GetData
Because in any case, you should check the code after getting the response from GetData NoNode. So why not call it directly?
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码