mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-19 21:38:05 +01:00
Report the maximum number of file descriptors allowed by the OS.
This commit is contained in:
committed by
Jon Chambers
parent
95428ab8b0
commit
e9b0829860
@@ -0,0 +1,23 @@
|
||||
package org.whispersystems.textsecuregcm.metrics;
|
||||
|
||||
import com.codahale.metrics.Gauge;
|
||||
import com.sun.management.UnixOperatingSystemMXBean;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
|
||||
/**
|
||||
* A gauge that reports the maximum number of file descriptors allowed by the operating system.
|
||||
*/
|
||||
public class MaxFileDescriptorGauge implements Gauge<Long> {
|
||||
|
||||
private final UnixOperatingSystemMXBean unixOperatingSystemMXBean;
|
||||
|
||||
public MaxFileDescriptorGauge() {
|
||||
this.unixOperatingSystemMXBean = (UnixOperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getValue() {
|
||||
return unixOperatingSystemMXBean.getMaxFileDescriptorCount();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user