How to get the create mode of a path in zookeeper

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)

Upvotes: 0

Views: 724

Answers (1)

Sandeep Das
Sandeep Das

Reputation: 1050

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

Upvotes: 3

Related Questions