forked from LBNL-UCB-STI/beam
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt #2 to add file leak detection
- Loading branch information
Hayden Atchley
committed
May 18, 2022
1 parent
d380f6b
commit a61fd2e
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}); | ||
} | ||
} |