Skip to content

Commit

Permalink
调整自动刷新时间
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjihuan committed Apr 30, 2022
1 parent d532d72 commit 7f85fa1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void agentmain(final String agentArgs, final Instrumentation inst)
isFirstLoad.compareAndSet(true, false);
executor.scheduleAtFixedRate(() -> {
main(foxMockAgentArgs, inst);
}, 20, 20, TimeUnit.SECONDS);
}, 10, 10, TimeUnit.SECONDS);
}
} catch (Exception e) {
LOG.error("FoxMockAgent.agentmain exception", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ public static void main(String[] args) {
try {
Properties config = Config.getConfig();

String foxMockFilePath = config.getProperty("foxMockFilePath");
String foxMockFilePath = config.getProperty("foxMockFilePath", "");
String foxMockAgentJarPath = config.getProperty("foxMockAgentJarPath");
String mockMethodWhiteList = config.getProperty("mockMethodWhiteList", "");
String mockDataHttpUrl = config.getProperty("mockDataHttpUrl", "");

if (Objects.isNull(foxMockAgentJarPath)) {
foxMockAgentJarPath = PathUtils.getAgentPath() + File.separator + "fox-mock-agent-2.0.jar";
}

VirtualMachine attach = VirtualMachine.attach(String.valueOf(getPid()));
String agentArgs = String.format("%s=foxMockFilePath=%s,mockMethodWhiteList=%s", foxMockAgentJarPath, foxMockFilePath, mockMethodWhiteList);
String agentArgs = String.format("%s=foxMockFilePath=%s,mockMethodWhiteList=%s,mockDataHttpUrl=%s", foxMockAgentJarPath, foxMockFilePath, mockMethodWhiteList, mockDataHttpUrl);
attach.loadAgent(agentArgs);
attach.detach();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static void main(String[] args) throws Exception {
System.out.println(String.format("你好 %s", userService.getUsers2()));
System.out.println(String.format("你好 %s", userService.getUser()));
System.out.println(String.format("你好 %s", userService.getUserDetail()));
System.out.println("----------------------------------------");
Thread.sleep(5000);
}

Expand Down

0 comments on commit 7f85fa1

Please sign in to comment.