| 108 | } |
| 109 | |
| 110 | public static OpenFilesInfo openFilesInfo() { |
| 111 | OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean(); |
| 112 | if (os instanceof UnixOperatingSystemMXBean) { |
| 113 | UnixOperatingSystemMXBean unixOperatingSystemMXBean = (UnixOperatingSystemMXBean) os; |
| 114 | return new OpenFilesInfo( |
| 115 | unixOperatingSystemMXBean.getOpenFileDescriptorCount(), |
| 116 | unixOperatingSystemMXBean.getMaxFileDescriptorCount()); |
| 117 | } else { |
| 118 | return null; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | public static MemoryInfo memoryInfo() { |
| 123 | Runtime runtime = Runtime.getRuntime(); |