Browse Source

Pull request #3279: REPORT-46589 把单独过滤的类抽出来 以过滤器形式调用

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '24c771bd55849fbf350bcd2e6e8698fdc62d7a4d':
  REPORT-46589 把单独过滤的类抽出来 以过滤器形式调用
feature/big-screen
Hades 4 years ago
parent
commit
3a246eb41c
  1. 4
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 34
      designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java

4
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<ClassLoader> set = ClassHelper.getClassLoaders(baseBook);
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) {

34
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<String> {
private static final Set<String> FILTER_SET = new HashSet<>();
private static final Filter<String> INSTANCE = new ClassFilter();
public static Filter<String> 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);
}
}
Loading…
Cancel
Save