The problem is really very simple,
When you use EPHEMERAL_SEQUENTIAL
mode to create the Znode
then the node which is created is not having the same name as a serial number is added, something like /zoo/duck0000000027
when I created with name /zoo/duck
but on the other hand when you create the node CreateMode.EPHEMERAL
then the node is created with same name as specified.
In EPHEMERAL_SEQUENTIAL
scenario if you want to add watcher
, then add the watcher
after creating then node something like,
String createdPath = zooKeeper1.create("/test13", null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
zooKeeper1.exists(createdPath, watcher);