|
|
@@ -6,7 +6,6 @@ import com.its.common.cluster.vo.ClusterMessage;
|
|
|
import com.its.common.cluster.vo.ClusterMessageData;
|
|
|
import com.its.common.cluster.vo.ClusterNode;
|
|
|
import com.utic.its.common.dto.CenterDto;
|
|
|
-import com.utic.its.common.dto.NET;
|
|
|
import com.utic.its.common.repository.ApplicationRepository;
|
|
|
import com.utic.its.rota.utic.server.cluster.dto.ClusterCommDto;
|
|
|
import com.utic.its.rota.utic.server.cluster.dto.RegionCenterInfo;
|
|
|
@@ -55,29 +54,36 @@ public class ClusterMasterService extends AbstractClusterMasterService {
|
|
|
log.info("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, {} Centers.",
|
|
|
this.clusterConfig.getId(), message.getClusterId(), infos.get(0).getCenters().size());
|
|
|
|
|
|
- for (ClusterCommDto clusterTodpDto : infos) {
|
|
|
- if (this.clusterConfig.getId() == clusterTodpDto.getClusterId()) {
|
|
|
+ for (ClusterCommDto rcvCenterList : infos) {
|
|
|
+ if (this.clusterConfig.getId() == rcvCenterList.getClusterId()) {
|
|
|
log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: clusterId: {}, master: {}, time: {}: clusterId error, this: {}, receive: {}",
|
|
|
- this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()), this.clusterConfig.getId(), clusterTodpDto.getClusterId());
|
|
|
+ this.clusterConfig.getId(), message.getClusterId(), message.isMaster(), ClusterUtils.timeToString(message.getCurrentTimeMillis()),
|
|
|
+ this.clusterConfig.getId(), rcvCenterList.getClusterId());
|
|
|
}
|
|
|
|
|
|
- for (RegionCenterInfo centerInfo: clusterTodpDto.getCenters()) {
|
|
|
+ for (RegionCenterInfo centerInfo: rcvCenterList.getCenters()) {
|
|
|
CenterDto center = ApplicationRepository.CENTER_MAP.get(centerInfo.getCenterId());
|
|
|
if (center == null) {
|
|
|
- return;
|
|
|
+ log.warn("ClusterNodeId: {}, ClusterMasterService.onClusterMessage: fromClusterNodeId: {}, center {} not found.",
|
|
|
+ this.clusterConfig.getId(), message.getClusterId(), centerInfo.getCenterId());
|
|
|
+ continue;
|
|
|
}
|
|
|
+// int oldRealClusterId = center.getRealClusterId();
|
|
|
if (center.getRealClusterId() == 0) {
|
|
|
// 최초 정보 수신한 경우에 해당함
|
|
|
centerInfo.toCopyInfo(center);
|
|
|
- return;
|
|
|
+// log.info("clusterIsZero: {}, {} ==> {}", center.getCenterId(), oldRealClusterId, center.getRealClusterId());
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
if (center.getRealClusterId() == message.getClusterId()) {
|
|
|
// 기존에 연결된 클러스터의 정보임
|
|
|
centerInfo.toCopyInfo(center);
|
|
|
- return;
|
|
|
+// log.info("clusterIsEqual: {}, {} ==> {}", center.getCenterId(), oldRealClusterId, center.getRealClusterId());
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
+// log.info("clusterIsOther: {}, {} ::: {}", center.getCenterId(), this.clusterConfig.getId(), center.getRealClusterId());
|
|
|
// 기타, 클러스터가 현재 서버인경우와 그렇치 않은경우(클러스터가 3개이상인 경우)
|
|
|
if (this.clusterConfig.getId() == center.getRealClusterId()) {
|
|
|
if (centerInfo.getNetState().isAlive() &&
|