protected static <T> Long getRootProcedureId(Map<Long, Procedure<T>> procedures,
    Procedure<T> proc) {
    while (proc.hasParent()) {
      proc = procedures.get(proc.getParentProcId());
      if (proc == null) {
        return null;
      }
    }
    return proc.getProcId();
  }
Helper to lookup the root Procedure ID given a specified procedure.
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/Procedure.java