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