We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fa6fc1 commit 6e3d4ffCopy full SHA for 6e3d4ff
JavaMonitorPlus/client/src/main/java/cn/yueshutong/client/core/order/Jmap.java
@@ -16,15 +16,18 @@ public class Jmap {
16
* @return
17
*/
18
public static String dump(String id){
19
- String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof");
+ //检验dump目录是否存在
20
File file = new File(PathUtil.getRootPath("dump/"));
21
if (!file.exists()){
22
file.mkdirs();
23
}
24
+ //若有已经存在的快照文件则删除
25
+ String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof");
26
File file1 = new File(path);
27
if (file1.exists()){
28
file1.delete();
29
30
+ //生成快照文件
31
ExecuteCmd.execute(new String[]{"jmap","-dump:format=b,file="+path, id});
32
return path;
33
0 commit comments