Browse Source

CHART-2425 【阻塞】【10.0】10.0release里的图表拖到表单里都不能用

socketio先不用,日志的再想方案处理
master
ju 7 years ago
parent
commit
69fe19bec4
  1. 92
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  2. 2
      designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

92
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -1,92 +0,0 @@
package com.fr.design.mainframe.loghandler.socketio;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream;
public class DesignerSocketIO {
private static Optional<Socket> socketIO = Optional.absent();
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override
public void call(Object... objects) {
try {
LogRecordTime[] logRecordTimes = LogUtils.readXMLLogRecords(new ByteArrayInputStream((byte[]) objects[0]));
for (LogRecordTime logRecordTime : logRecordTimes) {
DesignerLogHandler.getInstance().printRemoteLog(logRecordTime);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
};
static {
EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
if (socketIO.isPresent()) {
socketIO.get().close();
socketIO = Optional.absent();
}
}
});
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() {
@Override
public void on(Event event, Workspace param) {
updateSocket();
}
});
}
public static void init() {
updateSocket();
}
private static void updateSocket() {
if (WorkContext.getCurrent().isLocal()) {
return;
}
try {
// RemoteEnvConfig config = ((RemoteEnv)env).getEnvConfig();
// String uri = String.format("http://%s:%s%s?%s=%s",
// config.getHost(),
// WebSocketConfig.getInstance().getPort(),
// EnvConstants.WS_NAMESPACE,
// DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
// EnvContext.currentToken());
//
// socketIO = Optional.of(IO.socket(new URI(uri)));
// socketIO.get().on(EnvConstants.WS_LOGRECORD, printLog);
// socketIO.get().on(EnvConstants.CONFIG, new Emitter.Listener() {
// @Override
// public void call(Object... objects) {
// if (objects == null || objects.length != 1) {
// throw new IllegalArgumentException("config should have only one param");
// }
// Object param = objects[0];
// if (param instanceof Class) {
// EventDispatcher.fire(ConfigEvent.EDIT, (Class<? extends Configuration>) param);
// }
// }
// });
// socketIO.get().connect();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}

2
designer-realize/src/com/fr/start/module/DesignerModuleActivator.java

@ -1,6 +1,5 @@
package com.fr.start.module; package com.fr.start.module;
import com.fr.design.mainframe.loghandler.socketio.DesignerSocketIO;
import com.fr.design.module.ChartDesignerModule; import com.fr.design.module.ChartDesignerModule;
import com.fr.design.module.DesignerModule; import com.fr.design.module.DesignerModule;
import com.fr.general.ModuleContext; import com.fr.general.ModuleContext;
@ -19,7 +18,6 @@ public class DesignerModuleActivator extends Activator implements Prepare {
public void start() { public void start() {
ModuleContext.startModule(DesignerModule.class.getName()); ModuleContext.startModule(DesignerModule.class.getName());
DesignerSocketIO.init();
ChartDesignerModule.register(); ChartDesignerModule.register();
} }

Loading…
Cancel
Save