diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 06bfd3cf7..f6b8f07d5 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -5,11 +5,11 @@ import com.fr.base.io.BaseBook; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.file.filter.ClassFilter; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; import com.fr.design.ui.util.UIUtil; @@ -474,7 +474,7 @@ public class HistoryTemplateListCache implements CallbackEvent { String name = template.getEditingFILE().getName(); String pluginId = context.getID(); long start = System.currentTimeMillis(); - Set set = ClassHelper.getClassLoaders(baseBook); + Set 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) { diff --git a/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java new file mode 100644 index 000000000..d89c546a9 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java @@ -0,0 +1,34 @@ +package com.fr.design.file.filter; + +import com.fr.stable.Filter; +import java.util.HashSet; +import java.util.Set; + +/** + * 过滤无需遍历的jdk class + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/7 + */ +public class ClassFilter implements Filter { + + + private static final Set FILTER_SET = new HashSet<>(); + + private static final Filter INSTANCE = new ClassFilter(); + + public static Filter getInstance() { + return INSTANCE; + } + + static { + FILTER_SET.add("java.awt.image.BufferedImage"); + FILTER_SET.add("sun.awt.AppContext"); + } + + @Override + public boolean accept(String s) { + return FILTER_SET.contains(s); + } +}