|
|
|
@ -2,13 +2,16 @@ package com.fr.design.mainframe.socketio;
|
|
|
|
|
|
|
|
|
|
import com.fr.config.RemoteConfigEvent; |
|
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.design.EnvChangeEntrance; |
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.loghandler.DesignerLogger; |
|
|
|
|
import com.fr.design.ui.util.UIUtil; |
|
|
|
|
import com.fr.event.Event; |
|
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
|
import com.fr.event.Listener; |
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
|
import com.fr.report.RemoteDesignConstants; |
|
|
|
|
import com.fr.serialization.SerializerHelper; |
|
|
|
@ -16,6 +19,7 @@ import com.fr.stable.ArrayUtils;
|
|
|
|
|
import com.fr.third.apache.log4j.spi.LoggingEvent; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
|
import com.fr.workspace.WorkspaceEvent; |
|
|
|
|
import com.fr.workspace.base.WorkspaceConstants; |
|
|
|
|
import com.fr.workspace.connect.WorkspaceConnection; |
|
|
|
|
import com.fr.workspace.server.socket.SocketInfoOperator; |
|
|
|
@ -30,6 +34,20 @@ import java.net.URL;
|
|
|
|
|
|
|
|
|
|
public class DesignerSocketIO { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
EventDispatcher.listen(WorkspaceEvent.LostConnect, new Listener<Workspace>() { |
|
|
|
|
@Override |
|
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
|
// 远程设计websocket不支持wss 所以断开无法提醒
|
|
|
|
|
// 使用远程设计的心跳断开来提醒断开
|
|
|
|
|
if (DesignerEnvManager.getEnvManager().isHttps()) { |
|
|
|
|
showConnectionLostDialog(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enum Status { |
|
|
|
|
Connected, |
|
|
|
|
Disconnected, |
|
|
|
@ -143,6 +161,13 @@ public class DesignerSocketIO {
|
|
|
|
|
* socket 只用推日志和通知配置变更 |
|
|
|
|
*/ |
|
|
|
|
if (status != Status.Disconnecting) { |
|
|
|
|
showConnectionLostDialog(); |
|
|
|
|
} |
|
|
|
|
status = Status.Disconnected; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private static void showConnectionLostDialog() { |
|
|
|
|
try { |
|
|
|
|
UIUtil.invokeAndWaitIfNeeded(new Runnable() { |
|
|
|
|
@Override |
|
|
|
@ -160,9 +185,6 @@ public class DesignerSocketIO {
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
status = Status.Disconnected; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//配置变更监听器
|
|
|
|
|
private static final Emitter.Listener modifyConfig = new Emitter.Listener() { |
|
|
|
|