code: public static void assertAndDestroyProcessGroup(String pgrpId, long interval,
                         boolean inBackground)
           throws IOException {
      // Make sure that the pid given is a process group leader
      if (!checkPidPgrpidForMatch(pgrpId, PROCFS)) {
        throw new IOException("Process with PID " + pgrpId  +
                            " is not a process group leader.");
      }
      destroyProcessGroup(pgrpId, interval, inBackground);
    }
docs: Make sure that the given pid is a process group leader and then
  destroy the process group.
  @param pgrpId   Process group id of to-be-killed-processes
  @param interval The time to wait before sending SIGKILL
  after sending SIGTERM
  @param inBackground Process is to be killed in the back ground with
  a separate thread