Skip to content

Instantly share code, notes, and snippets.

View witbrock's full-sized avatar

Michael Witbrock witbrock

View GitHub Profile
@jtai
jtai / Descriptors.java
Created April 17, 2013 23:44
Java program to print out open / max file descriptors
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.lang.reflect.Method;
class Descriptors {
public static void main(String [ ] args) {
OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
try {
Method getMaxFileDescriptorCountField = osMxBean.getClass().getDeclaredMethod("getMaxFileDescriptorCount");
Method getOpenFileDescriptorCountField = osMxBean.getClass().getDeclaredMethod("getOpenFileDescriptorCount");