public int checkBookiesUp(int count,int timeout) throws Exception {
  ZooKeeper zkc=connectZooKeeper(zkHost,zkPort,zkTimeoutSec);
  try {
    int mostRecentSize=0;
    for (int i=0; i < timeout; i++) {
      try {
        List<String> children=zkc.getChildren("/ledgers/available",false);
        children.remove("readonly");
        mostRecentSize=children.size();
        if ((mostRecentSize > count) || LOG.isDebugEnabled()) {
          LOG.info("Found " + mostRecentSize + " bookies up, "+ "waiting for "+ count);
          if ((mostRecentSize > count) || LOG.isTraceEnabled()) {
            for (            String child : children) {
              LOG.info(" server: " + child);
            }
          }
        }
        if (mostRecentSize == count) {
          break;
        }
      }
 catch (      KeeperException e) {
      }
      Thread.sleep(1000);
    }
    return mostRecentSize;
  }
  finally {
    zkc.close();
  }
}

public int checkBookiesUp ( int count , int timeout ) throws Exception { ZooKeeper zkc = connectZooKeeper ( zkHost , zkPort , zkTimeoutSec ) ; try { int mostRecentSize = 0 ; for ( int i = 0 ; i < timeout ; i ++ ) { try { List < String > children = zkc . getChildren ( "/ledgers/available" , false ) ; children . remove ( "readonly" ) ; mostRecentSize = children . size ( ) ; if ( ( mostRecentSize > count ) || LOG . isDebugEnabled ( ) ) { LOG . info ( "Found " + mostRecentSize + " bookies up, " + "waiting for " + count ) ; if ( ( mostRecentSize > count ) || LOG . isTraceEnabled ( ) ) { for ( String child : children ) { LOG . info ( " server: " + child ) ; } } } if ( mostRecentSize == count ) { break ; } } catch ( KeeperException e ) { } Thread . sleep ( 1000 ) ; } return mostRecentSize ; } finally { zkc . close ( ) ; } }
check that a number of bookies are available
