@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "RV_DONT_JUST_NULL_CHECK_READLINE",
      justification = "used by testing")
  public int getNumberOfRunningProcess() {
    if (!isUnix()) {
      return 0;
    }

    InputStream inputStream = null;
    InputStreamReader inputStreamReader = null;
    BufferedReader bufferedReader = null;

    try {
      int count = 0;
      Process p = Runtime.getRuntime().exec("ps -e");
      inputStream = p.getInputStream();
      inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
      bufferedReader = new BufferedReader(inputStreamReader);
      while (bufferedReader.readLine() != null) {
        count++;
      }
      return count - 1; // -1 because there is a headline
    } catch (IOException e) {
      return -1;
    } finally {
      if (bufferedReader != null) {
        try {
          bufferedReader.close();
        } catch (IOException e) {
          LOG.warn("Not able to close the BufferedReader", e);
        }
      }
      if (inputStreamReader != null) {
        try {
          inputStreamReader.close();
        } catch (IOException e) {
          LOG.warn("Not able to close the InputStreamReader", e);
        }
      }
      if (inputStream != null) {
        try {
          inputStream.close();
        } catch (IOException e) {
          LOG.warn("Not able to close the InputStream", e);
        }
      }
    }
  }
Workaround to get the current number of process running. Approach is the one described here:
http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java
hbase-common/src/main/java/org/apache/hadoop/hbase/util/JVM.java