Skip to content

Commit 6e3d4ff

Browse files
author
onblog
committed
生成快照文件的bug
1 parent 3fa6fc1 commit 6e3d4ff

File tree

1 file changed

+4
-1
lines changed
  • JavaMonitorPlus/client/src/main/java/cn/yueshutong/client/core/order

1 file changed

+4
-1
lines changed

JavaMonitorPlus/client/src/main/java/cn/yueshutong/client/core/order/Jmap.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,18 @@ public class Jmap {
1616
* @return
1717
*/
1818
public static String dump(String id){
19-
String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof");
19+
//检验dump目录是否存在
2020
File file = new File(PathUtil.getRootPath("dump/"));
2121
if (!file.exists()){
2222
file.mkdirs();
2323
}
24+
//若有已经存在的快照文件则删除
25+
String path = PathUtil.getRootPath("dump/"+id+"_heap.hprof");
2426
File file1 = new File(path);
2527
if (file1.exists()){
2628
file1.delete();
2729
}
30+
//生成快照文件
2831
ExecuteCmd.execute(new String[]{"jmap","-dump:format=b,file="+path, id});
2932
return path;
3033
}

0 commit comments

Comments
 (0)