Browse Source

Pull request #3749: REPORT-48965 出现concurrentModification异常

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

* commit '6daaa9f4f9b0bd2ea5f0a4d67b62660895bb5c6c':
  REPORT-48965 使用批量添加 减少容器复制次数
  REPORT-48965 出现concurrentModification异常
feature/big-screen
Hades 4 years ago
parent
commit
a7cabd6eaf
  1. 16
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

16
designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

@ -13,12 +13,14 @@ import javax.swing.KeyStroke;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
/** /**
* 插入单元格元素和插入悬浮元素的一些集合方法 * 插入单元格元素和插入悬浮元素的一些集合方法
@ -27,8 +29,8 @@ import java.util.concurrent.ConcurrentMap;
* @version 2017年11月17日14点39分 * @version 2017年11月17日14点39分
*/ */
public class ActionFactory { public class ActionFactory {
private static LinkedHashSet<Class<?>> actionClasses = new LinkedHashSet<>(); private static Set<Class<?>> actionClasses = new CopyOnWriteArraySet<>();
private static LinkedHashSet<Class<?>> floatActionClasses = new LinkedHashSet<>(); private static Set<Class<?>> floatActionClasses = new CopyOnWriteArraySet<>();
private static Class chartCollectionClass = null; private static Class chartCollectionClass = null;
/** /**
* 无需每次实例化的悬浮元素编辑器 * 无需每次实例化的悬浮元素编辑器
@ -256,14 +258,14 @@ public class ActionFactory {
*/ */
public static void registerCellInsertActionClass(Class<?>[] cls) { public static void registerCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referCellInsertActionClass(Class<?>[] cls) { public static void referCellInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
actionClasses.clear(); actionClasses.clear();
Collections.addAll(actionClasses, cls); actionClasses.addAll(Arrays.asList(cls));
} }
} }
@ -321,14 +323,14 @@ public class ActionFactory {
*/ */
public static void registerFloatInsertActionClass(Class<?>[] cls) { public static void registerFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }
public static void referFloatInsertActionClass(Class<?>[] cls) { public static void referFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) { if (cls != null) {
floatActionClasses.clear(); floatActionClasses.clear();
Collections.addAll(floatActionClasses, cls); floatActionClasses.addAll(Arrays.asList(cls));
} }
} }

Loading…
Cancel
Save