From 24c771bd55849fbf350bcd2e6e8698fdc62d7a4d Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 7 Jan 2021 14:20:36 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-46589=20=E6=8A=8A=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=9A=84=E7=B1=BB=E6=8A=BD=E5=87=BA=E6=9D=A5?= =?UTF-8?q?=20=E4=BB=A5=E8=BF=87=E6=BB=A4=E5=99=A8=E5=BD=A2=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/file/HistoryTemplateListCache.java | 4 +-- .../fr/design/file/filter/ClassFilter.java | 34 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java 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 06bfd3cf74..f6b8f07d52 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 0000000000..d89c546a98 --- /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); + } +}