Skip to content

Commit 049b77c

Browse files
tiezhuFlechazoW
tiezhu
authored andcommitted
[hotfix-52032][core] Fix load dirty-plugins throws error of "Trying to access closed classloader. Please check if you store classloaders directly or indirectly in static fields".
1 parent 1c21978 commit 049b77c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Diff for: flinkx-core/src/main/java/com/dtstack/flinkx/util/DataSyncFactoryUtil.java

+4-10
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,11 @@ public static DirtyDataCollector discoverDirty(DirtyConf conf) {
115115
try {
116116
String pluginName = conf.getType();
117117
String pluginClassName = PluginUtil.getPluginClassName(pluginName, OperatorType.dirty);
118-
Set<URL> urlList =
119-
PluginUtil.getJarFileDirPath(pluginName, conf.getLocalPluginPath(), null, "");
120118

121-
final DirtyDataCollector consumer =
122-
ClassLoaderManager.newInstance(
123-
urlList,
124-
cl -> {
125-
Class<?> clazz = cl.loadClass(pluginClassName);
126-
Constructor<?> constructor = clazz.getConstructor();
127-
return (DirtyDataCollector) constructor.newInstance();
128-
});
119+
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
120+
Class<?> clazz = classLoader.loadClass(pluginClassName);
121+
Constructor<?> constructor = clazz.getConstructor();
122+
final DirtyDataCollector consumer = (DirtyDataCollector) constructor.newInstance();
129123
consumer.initializeConsumer(conf);
130124
return consumer;
131125
} catch (Exception e) {

0 commit comments

Comments
 (0)