Browse Source

REPORT-73318【设计器环境监测】服务器finedb有脏数据,设计器远程切换,过程很慢且没有自动监测弹窗

处理切换远程时不生效的逻辑
feature/x
Harrison 3 years ago
parent
commit
0e4183ca64
  1. 18
      designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java

18
designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java vendored

@ -18,6 +18,7 @@ import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.start.server.EmbedServerEvent; import com.fr.start.server.EmbedServerEvent;
import com.fr.task.Once;
import com.fr.update.delay.DelayHelper; import com.fr.update.delay.DelayHelper;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
@ -72,6 +73,14 @@ public class EnvDetectorCenter {
} }
}; };
private final Once launchOnce = new Once(() -> {
// 添加启动完成监听
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, START_UP_COMPLETE_LISTENER);
// 切换完成后的监听
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, AFTER_SWITCH_LISTENER);
});
private final AtomicReference<DetectorProcess> PROCESS = new AtomicReference<>(); private final AtomicReference<DetectorProcess> PROCESS = new AtomicReference<>();
public static EnvDetectorCenter getInstance() { public static EnvDetectorCenter getInstance() {
@ -96,6 +105,7 @@ public class EnvDetectorCenter {
// 默认是启动 // 默认是启动
PROCESS.set(DetectorProcess.DESIGN_LAUNCH); PROCESS.set(DetectorProcess.DESIGN_LAUNCH);
launchOnce.run();
listen(); listen();
} }
@ -189,12 +199,6 @@ public class EnvDetectorCenter {
private void listen() { private void listen() {
// 添加启动完成监听
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, START_UP_COMPLETE_LISTENER);
// 切换完成后的监听
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, AFTER_SWITCH_LISTENER);
// 内置服务器监听 // 内置服务器监听
EventDispatcher.listen(EmbedServerEvent.BeforeStart, BEFORE_START_LISTENER); EventDispatcher.listen(EmbedServerEvent.BeforeStart, BEFORE_START_LISTENER);
EventDispatcher.listen(EmbedServerEvent.AfterStart, AFTER_START_LISTENER); EventDispatcher.listen(EmbedServerEvent.AfterStart, AFTER_START_LISTENER);
@ -202,8 +206,6 @@ public class EnvDetectorCenter {
private void stopListen() { private void stopListen() {
EventDispatcher.stopListen(START_UP_COMPLETE_LISTENER);
EventDispatcher.stopListen(AFTER_SWITCH_LISTENER);
EventDispatcher.stopListen(BEFORE_START_LISTENER); EventDispatcher.stopListen(BEFORE_START_LISTENER);
EventDispatcher.stopListen(AFTER_START_LISTENER); EventDispatcher.stopListen(AFTER_START_LISTENER);
} }

Loading…
Cancel
Save