Browse Source

Pull request #10201: REPORT-80940 IOFileAttrMark接口问题

Merge in DESIGN/design from ~LEO.QIN/design:release/10.0 to release/10.0

* commit '73f15873a37da38134bebf60dddc12d46a0a8070':
  REPORT-80940 IOFileAttrMark接口问题 【问题原因】插件启用后未刷新 【改动思路】插件启用后刷新;修改AttrMap中key标签 【review建议】
  REPORT-80940 IOFileAttrMark接口问题 【问题原因】插件启用后未刷新 【改动思路】插件启用后刷新;修改AttrMap中key标签 【review建议】
security/10.0
Leo.Qin-覃宇攀 2 years ago
parent
commit
4d390e1d8d
  1. 35
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

35
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -445,14 +445,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
int size = historyList.size();
for (int i = 0; i < size; i++) {
JTemplate<?, ?> template = historyList.get(i);
// 判断刷新逻辑比较耗时,且可能出现插件安装后误判导致不刷新
// 插件安装/启用场景比较少,因此插件安装/启用后每次均进行刷新
FILE file = template.getEditingFILE();
boolean needReload = context == null || needReloadTemplate(context, template);
if (needReload) {
FILE stashFile = template.templateToStashFile();
if (stashFile != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
template.refreshResource(stashFile);
}
FILE stashFile = template.templateToStashFile();
if (stashFile != null) {
FineLoggerFactory.getLogger().info("{} is being reloaded", file.getName());
template.refreshResource(stashFile);
}
}
FineLoggerFactory.getLogger().info("Plugin env change reload all template ended");
@ -474,28 +473,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
_reloadAllEditingTemplate(null);
}
private boolean needReloadTemplate(PluginContext context, JTemplate<?, ?> template) {
BaseBook baseBook = template.getTarget();
if (baseBook != null) {
String name = template.getEditingFILE().getName();
String pluginId = context.getID();
long start = System.currentTimeMillis();
Set<ClassLoader> set = ClassHelper.getClassLoadersByFilter(baseBook, ClassFilter.getInstance());
FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start));
if (set != null) {
for (ClassLoader classLoader : set) {
if (ComparatorUtils.equals(pluginId, PluginManager.detectLeakingPlugin(classLoader))) {
return true;
}
}
} else {
// set为null说明 检测classloader 这里返回true直接刷新 兜底行为
return true;
}
}
return false;
}
public void replaceCurrentEditingTemplate(JTemplate<?, ?> jt) {
int index = contains(this.editingTemplate);
this.editingTemplate = jt;

Loading…
Cancel
Save