packageorg.ds.utils;importorg.apache.zookeeper.CreateMode;importorg.apache.zookeeper.ZooDefs;importorg.apache.zookeeper.ZooKeeper;publicclassHelper{/** * Create a node in ZooKeeper if it doesn't exist. * * @param zooKeeper the ZooKeeper instance to use * @param nodePath the path of the node to create */publicstaticvoidcreateNodeIfDoesNotExists(ZooKeeperzooKeeper,StringnodePath){try{if(zooKeeper.exists(nodePath,false)==null){zooKeeper.create(nodePath,newbyte[0],ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);}}catch(Exceptione){}}}