diff --git a/src/main/java/beam/utils/FileLeakDetector.java b/src/main/java/beam/utils/FileLeakDetector.java new file mode 100644 index 00000000000..7f9afab7508 --- /dev/null +++ b/src/main/java/beam/utils/FileLeakDetector.java @@ -0,0 +1,22 @@ +package beam.utils; + +import java.lang.management.ManagementFactory; +import org.kohsuke.file_leak_detector.Main; + +public class FileLeakDetector { + + public static String processPid() { + String name = ManagementFactory.getRuntimeMXBean().getName(); + String[] split = name.split("@"); + if (split.length != 2) { + throw new RuntimeException("Got unexpected process name: " + name); + } + return split[0]; + } + + public static void main(String[] args) { + String PID = processPid(); +// Main fld = new Main(); + Main.main(new String[] {PID, "test"}); + } +} \ No newline at end of file