public boolean leave ( ) throws KeeperException , InterruptedException { zooKeeper . delete ( rootPath + "/" + name , 0 ) ; while ( true ) { synchronized ( mutex ) { List < String > list = zooKeeper . getChildren ( rootPath , true ) ; if ( list . size ( ) > 0 ) { mutex . wait ( ) ; } else { return true ; } } } }
Wait until all nodes leave barrier