Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve]:Improve plugin #2744

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void deletePlugins(Set<Long> ids) {
plugin.setEnableStatus(false);
updateStatus(plugin);
}
// reload classloader
loadJarToClassLoader();
for (PluginMetadata plugin : plugins) {
try {
Expand All @@ -146,8 +147,7 @@ public void deletePlugins(Set<Long> ids) {
}
pluginParamDao.deletePluginParamsByPluginMetadataIdIn(ids);
syncPluginStatus();
// reload classloader
loadJarToClassLoader();

}

/**
Expand All @@ -167,7 +167,7 @@ public void updateStatus(PluginMetadata plugin) {
PluginMetadata metadata = pluginMetadata.get();
metadata.setEnableStatus(plugin.getEnableStatus());
metadataDao.save(metadata);
syncPluginStatus();
syncSinglePluginStatus(metadata);
} else {
throw new IllegalArgumentException("The plugin is not existed");
}
Expand Down Expand Up @@ -368,6 +368,18 @@ private void syncPluginStatus() {
ITEM_TO_PLUGINMETADATAID_MAP.putAll(itemToPluginMetadataIdMap);
}

private void syncSinglePluginStatus(PluginMetadata plugin) {
if (plugin == null || CollectionUtils.isEmpty(plugin.getItems())){
return;
}
for (PluginItem item : plugin.getItems()) {
PLUGIN_ENABLE_STATUS.put(item.getClassIdentifier(), plugin.getEnableStatus());
ITEM_TO_PLUGINMETADATAID_MAP.put(item.getClassIdentifier(), plugin.getId());
}


}

@PostConstruct
private void initParams() {
try {
Expand Down
Loading