提交 1925498e authored 作者: taojinlong's avatar taojinlong

fix: 插件卸载

上级 586f4b03
...@@ -26,8 +26,7 @@ public class LoadjarUtil { ...@@ -26,8 +26,7 @@ public class LoadjarUtil {
public List<?> loadJar(String jarPath, MyPlugin myPlugin) throws Exception{ public List<?> loadJar(String jarPath, MyPlugin myPlugin) throws Exception{
File jar = new File(jarPath); File jar = new File(jarPath);
URI uri = jar.toURI(); URI uri = jar.toURI();
String moduleName = jarPath.substring(jarPath.lastIndexOf("/")+1,jarPath.lastIndexOf(".")); String moduleName = myPlugin.getModuleName() + "-" + myPlugin.getVersion();
if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){ if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){
ClassloaderResponsity.getInstance().removeClassLoader(moduleName); ClassloaderResponsity.getInstance().removeClassLoader(moduleName);
......
...@@ -139,7 +139,7 @@ public class PluginService { ...@@ -139,7 +139,7 @@ public class PluginService {
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
} catch (Exception e) { } catch (Exception e) {
if (StringUtils.isNotEmpty(targetDir)) { if (StringUtils.isNotEmpty(targetDir)) {
DeFileUtils.deleteFile(targetDir); deleteJarFile(myPlugin);
} }
LogUtil.error(e.getMessage(), e); LogUtil.error(e.getMessage(), e);
DEException.throwException(e); DEException.throwException(e);
...@@ -199,9 +199,7 @@ public class PluginService { ...@@ -199,9 +199,7 @@ public class PluginService {
if(CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))){ if(CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))){
throw new RuntimeException(Translator.get("i18n_plugin_not_allow_delete")); throw new RuntimeException(Translator.get("i18n_plugin_not_allow_delete"));
} }
SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "DsProvider"); loadjarUtil.deleteModule(myPlugin.getModuleName() + "-" + myPlugin.getVersion());
SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "QueryProvider");
SpringContextUtil.getBeanFactory().removeBeanDefinition(myPlugin.getDsType() + "Service");
} }
myPluginMapper.deleteByPrimaryKey(pluginId); myPluginMapper.deleteByPrimaryKey(pluginId);
return true; return true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论