protected static void waitRegionInTransition(final MasterProcedureEnv env,
    final List<RegionInfo> regions) throws IOException {
    final RegionStates states = env.getAssignmentManager().getRegionStates();
    for (final RegionInfo region : regions) {
      ProcedureSyncWait.waitFor(env, "regions " + region.getRegionNameAsString() + " in transition",
        new ProcedureSyncWait.Predicate<Boolean>() {
          @Override
          public Boolean evaluate() throws IOException {
            return !states.isRegionInTransition(region);
          }
        });
    }
  }
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