code: public static void killProcessGroup(String pgrpId) {
  
      //If process tree is not alive then return immediately.
      if(!ProcessTree.isProcessGroupAlive(pgrpId)) {
        return;
      }
  
      String[] args = { "kill", "-9", "-"+pgrpId };
      ShellCommandExecutor shexec = new ShellCommandExecutor(args);
      try {
        shexec.execute();
      } catch (IOException e) {
        LOG.warn("Error sending SIGKILL to process group "+ pgrpId + " ."+ 
            StringUtils.stringifyException(e));
      } finally {
        LOG.info("Killing process group" + pgrpId + " with SIGKILL. Exit code "
            + shexec.getExitCode());
      }
    }
docs: Sends kill signal to all process belonging to same process group,
  forcefully terminating the process group.
  
  @param pgrpId process group id