|
|
@@ -89,6 +89,8 @@ public class RotaUticClientRestController {
|
|
|
int onLine = 0;
|
|
|
int node1 = 0;
|
|
|
int node2 = 0;
|
|
|
+ int node1Tot = 0;
|
|
|
+ int node2Tot = 0;
|
|
|
List<String> keySet = new ArrayList<>(ApplicationRepository.CENTER_MAP.keySet());
|
|
|
Collections.sort(keySet);
|
|
|
for (String key : keySet) {
|
|
|
@@ -108,6 +110,12 @@ public class RotaUticClientRestController {
|
|
|
node2++;
|
|
|
}
|
|
|
}
|
|
|
+ if (region.getClusterId() == 1) {
|
|
|
+ node1Tot++;
|
|
|
+ }
|
|
|
+ if (region.getClusterId() == 2) {
|
|
|
+ node2Tot++;
|
|
|
+ }
|
|
|
DecimalFormat dF = new DecimalFormat("#,###");
|
|
|
String recvTime = dF.format(region.getRecvTraffic().getRecvSeconds());
|
|
|
|
|
|
@@ -126,7 +134,7 @@ public class RotaUticClientRestController {
|
|
|
}
|
|
|
sb.append(heading).append(sep);
|
|
|
sb.append(String.format("Total : %d, OnLine(Connect): %d", total, onLine)).append(sep);
|
|
|
- sb.append(String.format("clusterNode1: %d, clusterNode2: %d", node1, node2)).append(sep);
|
|
|
+ sb.append(String.format("clusterNode1: %d/%d, clusterNode2: %d/%d", node1, node1Tot, node2, node2Tot)).append(sep);
|
|
|
sb.append(heading).append(sep);
|
|
|
return sb.toString();
|
|
|
}
|
|
|
@@ -143,6 +151,38 @@ public class RotaUticClientRestController {
|
|
|
return ResponseEntity.ok(result);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/api/init/reset")
|
|
|
+ public ResponseEntity<?> reset() {
|
|
|
+ int resetCount = 0;
|
|
|
+ List<String> keySet = new ArrayList<>(ApplicationRepository.CENTER_MAP.keySet());
|
|
|
+ Collections.sort(keySet);
|
|
|
+ for (String key : keySet) {
|
|
|
+ CenterDto region = ApplicationRepository.CENTER_MAP.get(key);
|
|
|
+ if (region == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.clusterConfig.isEnabled()) {
|
|
|
+ if (region.getNetState().isAlive()) {
|
|
|
+ if (this.clusterConfig.getId() != region.getRealClusterId()) {
|
|
|
+ // 다른 노드에서 작업을 수행하기로 설정된 지역센터의 연결을 종료한다.
|
|
|
+ try {
|
|
|
+ if (region.getNetState().getChannel() != null) {
|
|
|
+ region.getNetState().getChannel().disconnect();
|
|
|
+ region.getNetState().getChannel().close();
|
|
|
+ region.getNetState().disConnect();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ // no logging
|
|
|
+ }
|
|
|
+ resetCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseEntity.ok("communication connect cluster reset initialized ok. cluster: " + this.clusterConfig.getId() + ", reset count: " + resetCount);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/api/init/conn")
|
|
|
public ResponseEntity<?> init() {
|
|
|
List<String> keySet = new ArrayList<>(ApplicationRepository.CENTER_MAP.keySet());
|
|
|
@@ -152,6 +192,11 @@ public class RotaUticClientRestController {
|
|
|
if (region == null) {
|
|
|
continue;
|
|
|
}
|
|
|
+// if (this.clusterConfig.isEnabled()) {
|
|
|
+// if (this.clusterConfig.getId() != region.getRealClusterId()) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
if (region.getNetState().isAlive()) {
|
|
|
region.getNetState().setConnectCount(1);
|