🐛 修复发送消息报错.
This commit is contained in:
@@ -46,7 +46,10 @@ public class ExecLogTailHandler extends AbstractWebSocketHandler {
|
||||
String trackerId = this.getTrackerId(id, info, host);
|
||||
String absolutePath = logsFileClient.getAbsolutePath(host.getPath());
|
||||
// 追踪器
|
||||
ExecLogTracker tracker = new ExecLogTracker(trackerId, absolutePath, session, host);
|
||||
ExecLogTracker tracker = new ExecLogTracker(trackerId,
|
||||
absolutePath,
|
||||
WebSockets.createSyncSession(session),
|
||||
host);
|
||||
// 执行
|
||||
AssetThreadPools.EXEC_LOG.execute(tracker);
|
||||
// 添加追踪器
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.orion.ext.tail.delay.DelayTrackerListener;
|
||||
import com.orion.ext.tail.mode.FileNotFoundMode;
|
||||
import com.orion.ext.tail.mode.FileOffsetMode;
|
||||
import com.orion.spring.SpringHolder;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.websocket.core.utils.WebSockets;
|
||||
import com.orion.visor.module.asset.define.config.AppTrackerConfig;
|
||||
import com.orion.visor.module.asset.entity.dto.ExecHostLogTailDTO;
|
||||
@@ -79,7 +80,20 @@ public class ExecLogTracker implements IExecLogTracker {
|
||||
|
||||
@Override
|
||||
public void read(byte[] bytes, int len, Tracker tracker) {
|
||||
WebSockets.sendText(session, config.getId() + LogConst.SEPARATOR + new String(bytes, 0, len));
|
||||
// 发送消息
|
||||
String message = config.getId() + LogConst.SEPARATOR + new String(bytes, 0, len);
|
||||
try {
|
||||
WebSockets.sendText(session, message);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
log.error("ExecLogTracker.send error", e);
|
||||
}
|
||||
// 重试
|
||||
try {
|
||||
WebSockets.retrySendText(session, message, Const.MS_100);
|
||||
} catch (Exception e) {
|
||||
log.error("ExecLogTracker.resend error fk", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user