This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch fix-pipe-plugin-loader-not-loaded-in-snapshot
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to
refs/heads/fix-pipe-plugin-loader-not-loaded-in-snapshot by this push:
new 3227ab9e6e0 Update PipePluginInfo.java
3227ab9e6e0 is described below
commit 3227ab9e6e04d7655f08e87c6caae037acd802f2
Author: Steve Yurong Su <[email protected]>
AuthorDate: Thu Mar 27 17:46:16 2025 +0800
Update PipePluginInfo.java
---
.../persistence/pipe/PipePluginInfo.java | 36 ++++++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
index d4d13116bad..c4971e7f737 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
@@ -228,11 +228,19 @@ public class PipePluginInfo implements SnapshotProcessor {
final String pluginDirPath =
pipePluginExecutableManager.getPluginsDirPath(pluginName);
final PipePluginClassLoader pipePluginClassLoader =
classLoaderManager.createPipePluginClassLoader(pluginDirPath);
- final Class<?> pluginClass =
- Class.forName(pipePluginMeta.getClassName(), true,
pipePluginClassLoader);
- pipePluginMetaKeeper.addPipePluginVisibility(
- pluginName, VisibilityUtils.calculateFromPluginClass(pluginClass));
- classLoaderManager.addPluginAndClassLoader(pluginName,
pipePluginClassLoader);
+ try {
+ final Class<?> pluginClass =
+ Class.forName(pipePluginMeta.getClassName(), true,
pipePluginClassLoader);
+ pipePluginMetaKeeper.addPipePluginVisibility(
+ pluginName,
VisibilityUtils.calculateFromPluginClass(pluginClass));
+ classLoaderManager.addPluginAndClassLoader(pluginName,
pipePluginClassLoader);
+ } catch (final Exception e) {
+ try {
+ pipePluginClassLoader.close();
+ } catch (final Exception ignored) {
+ }
+ throw e;
+ }
}
return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
@@ -370,11 +378,19 @@ public class PipePluginInfo implements SnapshotProcessor {
final String pluginDirPath =
pipePluginExecutableManager.getPluginsDirPath(pluginName);
final PipePluginClassLoader pipePluginClassLoader =
classLoaderManager.createPipePluginClassLoader(pluginDirPath);
- final Class<?> pluginClass =
- Class.forName(pipePluginMeta.getClassName(), true,
pipePluginClassLoader);
- pipePluginMetaKeeper.addPipePluginVisibility(
- pluginName,
VisibilityUtils.calculateFromPluginClass(pluginClass));
- classLoaderManager.addPluginAndClassLoader(pluginName,
pipePluginClassLoader);
+ try {
+ final Class<?> pluginClass =
+ Class.forName(pipePluginMeta.getClassName(), true,
pipePluginClassLoader);
+ pipePluginMetaKeeper.addPipePluginVisibility(
+ pluginName,
VisibilityUtils.calculateFromPluginClass(pluginClass));
+ classLoaderManager.addPluginAndClassLoader(pluginName,
pipePluginClassLoader);
+ } catch (final Exception e) {
+ try {
+ pipePluginClassLoader.close();
+ } catch (final Exception ignored) {
+ }
+ throw e;
+ }
} catch (final Exception e) {
LOGGER.warn(
"Failed to load plugin class for plugin [{}] when loading
snapshot [{}] ",