public boolean enter() throws KeeperException, InterruptedException {
  zooKeeper.create(rootPath + "/" + name,new byte[0],Ids.OPEN_ACL_UNSAFE,CreateMode.EPHEMERAL);
  while (true) {
synchronized (mutex) {
      List<String> list=zooKeeper.getChildren(rootPath,true);
      if (list.size() < size) {
        mutex.wait();
      }
 else {
        return true;
      }
    }
  }
}

public boolean enter ( ) throws KeeperException , InterruptedException { zooKeeper . create ( rootPath + "/" + name , new byte [ 0 ] , Ids . OPEN_ACL_UNSAFE , CreateMode . EPHEMERAL ) ; while ( true ) { synchronized ( mutex ) { List < String > list = zooKeeper . getChildren ( rootPath , true ) ; if ( list . size ( ) < size ) { mutex . wait ( ) ; } else { return true ; } } } }
wait until required number of nodes join barrier
