|
|
@@ -1,5 +1,6 @@
|
|
|
package com.its.common.cluster.config;
|
|
|
|
|
|
+import com.its.common.cluster.vo.ClusterNET;
|
|
|
import com.its.common.cluster.vo.ClusterNode;
|
|
|
import io.netty.util.AttributeKey;
|
|
|
import lombok.Data;
|
|
|
@@ -38,6 +39,18 @@ public abstract class AbstractClusterConfig {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public boolean isClusterAlive(int clusterId) {
|
|
|
+ ClusterNode clusterNode = this.clusterMap.get(clusterId);
|
|
|
+ if (clusterNode == null) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return clusterNode.getElectionState().getState() != ClusterNET.CLOSED;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ClusterNode getClusterNode(int clusterId) {
|
|
|
+ return this.clusterMap.get(clusterId);
|
|
|
+ }
|
|
|
+
|
|
|
public void loggingInfo() {
|
|
|
log.info("Cluster config enabled: {}", this.enabled);
|
|
|
log.info(" id: {}", this.id);
|