Skip to content

Commit

Permalink
jmx和agent通信修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zifeihan committed Jun 5, 2020
1 parent a10d6a9 commit ac477eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agent/src/main/java/fun/codec/friday/agent/BootStrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ private static void start(Instrumentation instrumentation) {
try {
ObjectName serverName = new ObjectName("fun.codec.friday:type=DumpService");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
DumpServiceMBean dumpMBean = new DumpService(instrumentation);
if (!mbs.isRegistered(serverName)) {
DumpServiceMBean dumpMBean = new DumpService(instrumentation);
mbs.registerMBean(dumpMBean, serverName);
}
mbs.getMBeanInfo(serverName);
logger.info("start MBeanServer success.");
} catch (Exception e) {
e.printStackTrace();
logger.warn("start mxbean server error.", e);
}
}
}
1 change: 0 additions & 1 deletion agent/src/main/java/fun/codec/friday/agent/SystemInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class SystemInfo {

public static String WORK_SPACE = HOME_PATH + File.separator + RuntimeMXBeanUtils.getPid();


public static String getTreePath(int pid) {
return HOME_PATH + File.separator + pid + File.separator + "dir";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import fun.codec.friday.agent.log.SampleLogger;
import fun.codec.friday.agent.tree.Clazz;
import fun.codec.friday.agent.tree.Package;
import fun.codec.friday.agent.util.EFile;
import fun.codec.friday.agent.util.RuntimeMXBeanUtils;

import java.io.File;
Expand All @@ -29,7 +30,7 @@ public DumpService(Instrumentation instrumentation) {
}
File file = new File(SystemInfo.WORK_SPACE + File.separator + "dir");
if (file.exists()) {
file.delete();
EFile.deleteFile(file);
} else {
file.mkdirs();
}
Expand Down

0 comments on commit ac477eb

Please sign in to comment.