提交 bd888f8b 编写于 作者: Z zhourui

fix

上级 2bdd6bd9
......@@ -148,4 +148,4 @@ if [ -d ${current_dir}/local/update ]; then
rm -Rf ${current_dir}/local/update
fi
fi
setsid ${current_dir}/jvm/linux/bin/java -server -Djava.awt.headless=true -Xms2g -Xmx5g -Duser.timezone=GMT+08 -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -jar ${current_dir}/console.jar
\ No newline at end of file
setsid ${current_dir}/jvm/linux/bin/java -javaagent:${current_dir}/console.jar -server -Djava.awt.headless=true -Xms2g -Xmx5g -Duser.timezone=GMT+08 -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError -jar ${current_dir}/console.jar
\ No newline at end of file
......@@ -35,14 +35,14 @@ public class InstrumentationAgent {
if (Files.exists(base.resolve(DYNAMIC_JARS))) {
load(base, DYNAMIC_JARS);
}
load(base, STORE_JARS);
load(base, COMMONS_EXT);
loadWithCfg(base, STORE_JARS);
loadWithCfg(base, COMMONS_EXT);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void load(Path base, String sub) throws IOException {
private static void loadWithCfg(Path base, String sub) throws IOException {
Path dir = base.resolve(sub);
Path cfg = dir.resolve(CFG);
if (Files.exists(dir) && Files.isDirectory(dir) && Files.exists(cfg) && Files.isRegularFile(cfg)) {
......@@ -74,6 +74,25 @@ public class InstrumentationAgent {
}
}
private static void load(Path base, String sub) throws IOException {
Path dir = base.resolve(sub);
if (Files.exists(dir) && Files.isDirectory(dir)) {
try (Stream<Path> stream = Files.list(dir)) {
stream.filter(
o -> o.toString().toLowerCase().endsWith(".zip") || o.toString().toLowerCase().endsWith(".jar"))
.forEach(o -> {
try {
INST.appendToSystemClassLoaderSearch(new JarFile(o.toString()));
} catch (IOException e) {
e.printStackTrace();
}
});
}
} else {
throw new IOException(String.format("invalid directory: %s", sub));
}
}
private static Path getBasePath() throws IOException, URISyntaxException {
Path path = Paths.get(InstrumentationAgent.class.getProtectionDomain().getCodeSource().getLocation().toURI());
Path version = path.resolveSibling("version.o2");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册