protected static void waitMetaRegions(final MasterProcedureEnv env) throws IOException {
    int timeout = env.getMasterConfiguration().getInt("hbase.client.catalog.timeout", 10000);
    try {
      long start = EnvironmentEdgeManager.currentTime();
      for (;;) {
        RegionStateNode rsn = env.getAssignmentManager().getRegionStates()
          .getRegionStateNode(RegionInfoBuilder.FIRST_META_REGIONINFO);
        if (rsn != null && rsn.isInState(RegionState.State.OPEN)) {
          return;
        }
        if (EnvironmentEdgeManager.currentTime() - start >= timeout) {
          throw new NotAllMetaRegionsOnlineException();
        }
        Thread.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
      }
    } catch (InterruptedException e) {
      throw (InterruptedIOException) new InterruptedIOException().initCause(e);
    }
  }
Helper to synchronously wait on conditions. This will be removed in the future (mainly when the
AssignmentManager will be replaced with a Procedure version) by using ProcedureYieldException,
and the queue will handle waiting and scheduling based on events.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedureSyncWait.java