public long getMaxFileDescriptorCount() {
    Long mfdc;
    if (!ibmvendor) {
      mfdc = runUnixMXBeanMethod("getMaxFileDescriptorCount");
      return (mfdc != null ? mfdc : -1);
    }
    InputStream in = null;
    BufferedReader output = null;
    try {
      // using linux bash commands to retrieve info
      Process p = Runtime.getRuntime().exec(new String[] { "bash", "-c", "ulimit -n" });
      in = p.getInputStream();
      output = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
      String maxFileDesCount;
      if ((maxFileDesCount = output.readLine()) != null) {
        return Long.parseLong(maxFileDesCount);
      }
    } catch (IOException ie) {
      LOG.warn("Not able to get the max number of file descriptors", ie);
    } finally {
      if (output != null) {
        try {
          output.close();
        } catch (IOException e) {
          LOG.warn("Not able to close the reader", e);
        }
      }
      if (in != null) {
        try {
          in.close();
        } catch (IOException e) {
          LOG.warn("Not able to close the InputStream", e);
        }
      }
    }
    return -1;
  }
Get the number of the maximum file descriptors the system can use. If Oracle java, it will use
the com.sun.management interfaces. Otherwise, this methods implements it (linux only).
@return max number of file descriptors the operating system can use.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/JVM.java