Skip to content

Commit

Permalink
Attempt #2 to add file leak detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayden Atchley committed May 18, 2022
1 parent d380f6b commit a61fd2e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/beam/utils/FileLeakDetector.java
Original file line number Diff line number Diff line change
@@ -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"});
}
}

0 comments on commit a61fd2e

Please sign in to comment.