|
@@ -37,7 +37,7 @@ public class TsiReportManager {
|
|
|
|
|
|
public void reportNodeSessions() {
|
|
|
final String fileName = "report";
|
|
|
- MDC.put("report", fileName);
|
|
|
+ MDC.put("filename", fileName);
|
|
|
|
|
|
int nodeCount = this.nodeManager.getTsiNodeVoMap().size();
|
|
|
log.info("================================================================================================================");
|
|
@@ -52,44 +52,6 @@ public class TsiReportManager {
|
|
|
log.info("{}", String.format("%10s %4s %7s %19s %19s %9s %6s %19s Remote-Address", "ID", "INTC", "Connect", "Connect Time", "Disconnect Time", "Connected", "Closed", "Last-Recv-Time"));
|
|
|
log.info("----------------------------------------------------------------------------------------------------------------");
|
|
|
|
|
|
-// this.tsiNodeVoMap.entrySet().stream()
|
|
|
-// .sorted(Map.Entry.comparingByKey()) // 키값 기준 오름차순 정렬
|
|
|
-// .forEach(entry -> {
|
|
|
-// TsiNodeVo node = entry.getValue();
|
|
|
-// String check = (node.isInstalled() ? "Y" : "N")
|
|
|
-// + (node.isSendNode() ? "Y" : "N")
|
|
|
-// + (node.isSendTest() ? "Y" : "N")
|
|
|
-// + (node.isSendCvim() ? "Y" : "N");
|
|
|
-//
|
|
|
-// if (node.isRegistered()) {
|
|
|
-// registered.getAndIncrement();
|
|
|
-// } else {
|
|
|
-// unknown++;
|
|
|
-// }
|
|
|
-//
|
|
|
-// String connect;
|
|
|
-// String info;
|
|
|
-// if (node.isConnect()) {
|
|
|
-// connected++;
|
|
|
-// connect = "Y";
|
|
|
-// info = NettyUtils.getRemoteAddress(node.getChannel());
|
|
|
-// } else {
|
|
|
-// connect = "N";
|
|
|
-// info = "---";
|
|
|
-// }
|
|
|
-//
|
|
|
-// String connectTm = sdf.format(new Date(node.getConnectTm()));
|
|
|
-// String disconnectTm = sdf.format(new Date(node.getDisconnectTm()));
|
|
|
-// String lastCommTm = sdf.format(new Date(node.getLastCommTm()));
|
|
|
-//
|
|
|
-// log.info("{}", String.format(
|
|
|
-// "%10s %4s %7s %19s %19s %9d %6d %19s %s",
|
|
|
-// node.getKey(), check, connect, connectTm,
|
|
|
-// disconnectTm, node.getConnectCount().get(),
|
|
|
-// node.getDisconnectCount().get(), lastCommTm, info
|
|
|
-// ));
|
|
|
-// });
|
|
|
-//
|
|
|
for (Map.Entry<Long, TsiNodeVo> obj : this.nodeManager.getTsiNodeVoMap().entrySet()) {
|
|
|
TsiNodeVo node = obj.getValue();
|
|
|
String check = (node.isInstalled() ? "Y" : "N");
|
|
@@ -125,13 +87,11 @@ public class TsiReportManager {
|
|
|
log.info("Total Nodes: {} EA, Registered: {} EA, Unknown: {} EA, Connected: {} EA", nodeCount, registered, unknown, connected);
|
|
|
log.info("==============================================");
|
|
|
|
|
|
- MDC.remove(fileName);
|
|
|
MDC.clear();
|
|
|
}
|
|
|
|
|
|
public void checkSessionTimeout(long timeout) {
|
|
|
final String fileName = "timeout";
|
|
|
- MDC.put("report", fileName);
|
|
|
|
|
|
String connectTm;
|
|
|
String lastCommTm;
|
|
@@ -143,21 +103,33 @@ public class TsiReportManager {
|
|
|
if (node.isConnect()) {
|
|
|
if ((currTm - node.getLastCommTm()) > timeout) {
|
|
|
try {
|
|
|
+ String ipAddress = node.getIpAddr();
|
|
|
+ if (node.getChannel() != null) {
|
|
|
+ ipAddress = NettyUtils.getRemoteIpAddress(node.getChannel());
|
|
|
+ }
|
|
|
+
|
|
|
AlarmOccrVo alarm = new AlarmOccrVo(AbstractDbmsVo.DBMS_ALARM_OCCR_HS);
|
|
|
alarm.setAlarmCode(TsiAlarmConfigVo.COMM_02);
|
|
|
alarm.setAlarmTarget(node.getKey());
|
|
|
- alarm.setAlarmValue(NettyUtils.getRemoteIpAddress(node.getChannel()));
|
|
|
+ alarm.setAlarmValue(ipAddress);
|
|
|
this.dbmsProcess.add(alarm, (int) Thread.currentThread().getId());
|
|
|
|
|
|
connectTm = sdf.format(new Date(node.getConnectTm()));
|
|
|
lastCommTm = sdf.format(new Date(node.getLastCommTm()));
|
|
|
- log.info("Recv Timeout: Node: {}, Connect: {}, LastCommTime: {}, timeout: {}",
|
|
|
+
|
|
|
+ MDC.put("filename", fileName);
|
|
|
+
|
|
|
+ log.info("Node: {}, Recv Timeout: Connect: {}, LastCommTime: {}, timeout: {}",
|
|
|
node.getKey(), connectTm, lastCommTm, timeout);
|
|
|
|
|
|
+ MDC.clear();
|
|
|
+
|
|
|
TsiChannelSession.sessionTimeout(node, NettyUtils.getRemoteIpAddress(node.getChannel()));
|
|
|
|
|
|
- node.getChannel().disconnect();
|
|
|
- node.getChannel().close();
|
|
|
+ if (node.getChannel() != null) {
|
|
|
+ node.getChannel().disconnect();
|
|
|
+ node.getChannel().close();
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
log.error("checkSessionTimeout: {}", e.getMessage());
|
|
@@ -165,14 +137,11 @@ public class TsiReportManager {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- MDC.remove(fileName);
|
|
|
- MDC.clear();
|
|
|
}
|
|
|
|
|
|
public void reportQueueInfo(boolean isAlert) {
|
|
|
final String fileName = "queue";
|
|
|
- MDC.put("report", fileName);
|
|
|
+ MDC.put("filename", fileName);
|
|
|
|
|
|
boolean isTail = false;
|
|
|
int remainingCapacity = 0;
|
|
@@ -240,7 +209,6 @@ public class TsiReportManager {
|
|
|
if (isTail) {
|
|
|
log.info("================================================================================================================");
|
|
|
}
|
|
|
- MDC.remove(fileName);
|
|
|
MDC.clear();
|
|
|
}
|
|
|
|