问题
In zookeeper,
I can usezookeeper.exists(path,false)
to check if the path exists.
But if the path exists, witch method can I use to get the create mode of the path?(Persistent or Ephemeral)
回答1:
On this call :zookeeper.exists(path,false) .. Zookeeper server will return you a Stat structure . From the Stat structure you check the property "ephemeralOwner" . this corresponds to session id of the owner of this znode if the znode is an ephemeral node. If it is not an ephemeral node, it will be zero.
Hope this will solve your problem
来源:https://stackoverflow.com/questions/25052422/how-to-get-the-create-mode-of-a-path-in-zookeeper