public static String createParticipantNode ( ZooKeeper zk , String dir , String prefix , byte [ ] data ) throws KeeperException , InterruptedException { createRootIfNotExist ( zk , dir ) ; String node = zk . create ( ZKUtil . joinZKPath ( dir , prefix + "_" ) , data , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL_SEQUENTIAL ) ; // Unlock the dir as initialized zk . setData ( dir , new byte [ ] { INITIALIZED } , - 1 ) ; return node ; }
Provide a way for clients to create nodes which comply with the leader election format without participating in a leader election