How to get the create mode of a path in zookeeper

北慕城南 提交于 2020-01-07 03:26:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!