barrierPath = baseBarrierPath+System.currentTimeMillis();
zk = newZooKeeper();
//be sure that the lock-place is created
try{
ZkCommandExecutor zkCommandExecutor = new ZkCommandExecutor(new BaseZkSessionManager(zk));
zkCommandExecutor.execute(new ZkCommand<Void>() {
@Override
public Void execute(ZooKeeper zk) throws KeeperException, InterruptedException {
zk.create(barrierPath,new byte[]{}, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
return null;
}