Skip to content

Commit 48ab598

Browse files
authored
Merge pull request #1465 from lilai23/classloader
set PluginClassLoader for plugin config
2 parents bafe18c + 970fd59 commit 48ab598

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/classloader/PluginClassLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
118118
}
119119

120120
// 确保局部类加载器不是当前类加载器,否则会stackoverflow
121-
if (loader != null && !this.equals(loader)) {
121+
if (loader != null && !this.equals(loader) && !(loader instanceof ServiceClassLoader)) {
122122
try {
123123
clazz = loader.loadClass(name);
124124
} catch (ClassNotFoundException e) {

sermant-agentcore/sermant-agentcore-core/src/main/java/com/huaweicloud/sermant/core/plugin/config/PluginConfigManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ private PluginConfigManager() {
6060
*/
6161
public static void loadPluginConfigs(Plugin plugin) {
6262
File pluginConfigFile = getPluginConfigFile(plugin.getPath());
63-
ClassLoader classLoader =
64-
plugin.getServiceClassLoader() != null ? plugin.getServiceClassLoader() : plugin.getPluginClassLoader();
63+
ClassLoader classLoader = plugin.getPluginClassLoader();
6564
for (BaseConfig config : ServiceLoader.load(PluginConfig.class, classLoader)) {
6665
Class<? extends BaseConfig> pluginConfigCls = config.getClass();
6766
String pluginConfigKey = ConfigKeyUtil.getCLTypeKey(ConfigKeyUtil.getTypeKey(pluginConfigCls),

0 commit comments

Comments
 (0)