提交 649621be authored 作者: Thomas Mueller's avatar Thomas Mueller

Support filter mode (jstack <pid> > java ThreadDumpCleaner)

上级 03bb08b9
...@@ -23,6 +23,16 @@ import java.util.regex.Pattern; ...@@ -23,6 +23,16 @@ import java.util.regex.Pattern;
public class ThreadDumpCleaner { public class ThreadDumpCleaner {
private static final String[] PATTERN = { private static final String[] PATTERN = {
"\"Concurrent Mark-Sweep GC Thread\".*\n",
"\"Exception Catcher Thread\".*\n",
"JNI global references:.*\n\n",
"\".*?\".*?\n java.lang.Thread.State:.*\n\n",
"\".*?\".*\n\n",
"\\$\\$YJP\\$\\$", "\\$\\$YJP\\$\\$",
"\"(Attach|Service|VM|GC|DestroyJavaVM|Signal|AWT|AppKit|C2 |Low Mem|" + "\"(Attach|Service|VM|GC|DestroyJavaVM|Signal|AWT|AppKit|C2 |Low Mem|" +
...@@ -52,8 +62,7 @@ public class ThreadDumpCleaner { ...@@ -52,8 +62,7 @@ public class ThreadDumpCleaner {
"\".*?\".*?\n java.lang.Thread.State:.*\n\t" + "\".*?\".*?\n java.lang.Thread.State:.*\n\t" +
"at java.net.SocketInputStream.socketRead0(?s).*?\n\n", "at java.net.SocketInputStream.socketRead0(?s).*?\n\n",
"JNI global references:.*\n\n",
}; };
private ArrayList<Pattern> patterns = new ArrayList<Pattern>(); private ArrayList<Pattern> patterns = new ArrayList<Pattern>();
...@@ -78,6 +87,9 @@ public class ThreadDumpCleaner { ...@@ -78,6 +87,9 @@ public class ThreadDumpCleaner {
outFile = args[++i]; outFile = args[++i];
} }
} }
if (args.length == 0) {
outFile = "-";
}
if (outFile == null) { if (outFile == null) {
outFile = inFile + ".clean.txt"; outFile = inFile + ".clean.txt";
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论