code: public static long getOpenFileHandlesLimit() {
  		if (OperatingSystem.isWindows()) { // getMaxFileDescriptorCount method is not available on Windows
  			return -1L;
  		}
  		Class<?> sunBeanClass;
  		try {
  			sunBeanClass = Class.forName("com.sun.management.UnixOperatingSystemMXBean");
  		}
  		catch (ClassNotFoundException e) {
  			return -1L;
  		}
  		
  		try {
  			Method fhLimitMethod = sunBeanClass.getMethod("getMaxFileDescriptorCount");
  			Object result = fhLimitMethod.invoke(ManagementFactory.getOperatingSystemMXBean());
  			return (Long) result;
  		}
  		catch (Throwable t) {
  			LOG.warn("Unexpected error when accessing file handle limit", t);
  			return -1L;
  		}
  	}
docs: Tries to retrieve the maximum number of open file handles. This method will only work on
  UNIX-based operating systems with Sun/Oracle Java versions.
  
  <p>If the number of max open file handles cannot be determined, this method returns {@code -1}.</p>
  
  @return The limit of open file handles, or {@code -1}, if the limit could not be determined.