Browse Source

REPORT-83195 卡顿点优化-根据插件提示修改了一下代码规范

feature/x
John.Ying-应志浩 2 years ago
parent
commit
135f588ff1
  1. 5
      designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java
  2. 2
      designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java
  3. 4
      designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java

5
designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java

@ -58,6 +58,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter {
* 简单记录事件执行时间的开关
*/
private static boolean easyChecker = false;
/**
* 一个标识位用于区分耗时任务时长检测(简单检测)和timer检测
*/
@ -331,7 +332,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter {
MAIN(NORMAL_MAIN_CLASS_NAME) {
@Override
void initEventQueue() {
if (StringUtils.equals("true", System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) {
if (StringUtils.equals(TURE_JVM, System.getProperty(CARTON_DEVELOPER_JVM_PARAM))) {
EventDispatchDeveloperMode.INSTANCE.initMonitoring();
} else {
EventDispatchThreadHangMonitor.initMonitoring();
@ -353,7 +354,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter {
MainClassType(String classPath) {
this.classPath = classPath;
}
public static final String TURE_JVM = "true";
String classPath;
/**

2
designer-base/src/main/java/com/fr/design/worker/save/SaveWorker.java

@ -88,7 +88,7 @@ public class SaveWorker extends SwingWorker<Boolean, Void> {
this.execute();
// worker纳入管理
WorkerManager.getInstance().registerWorker(taskName, this);
SaveTypeWorker.saveTypePool.execute(() -> {
SaveTypeWorker.SAVE_TYPE_POOL.execute(() -> {
while (true) {
if (stopWatch.getTime() > TIME_OUT || isDone()) {
if (!isDone()) {

4
designer-base/src/main/java/com/fr/design/worker/save/type/SaveTypeWorker.java

@ -22,7 +22,7 @@ import java.util.concurrent.ExecutorService;
*/
public class SaveTypeWorker extends SwingWorker<SaveType, Void> {
public static final ExecutorService saveTypePool = FineExecutors.newSingleThreadExecutor();
public static final ExecutorService SAVE_TYPE_POOL = FineExecutors.newSingleThreadExecutor();
private final Callable<SaveType.TypeEnum> callable;
@ -58,7 +58,7 @@ public class SaveTypeWorker extends SwingWorker<SaveType, Void> {
StopWatch stopWatch = StopWatch.createStarted();
this.template.setSaving(true);
this.execute();
saveTypePool.execute(() -> {
SAVE_TYPE_POOL.execute(() -> {
while (true) {
//大于最大等待时间或者worker已经完成该线程都要结束循环
if (stopWatch.getTime() > TIME_OUT || isDone()) {

Loading…
Cancel
Save