Преглед на файлове

ha-cluster config update

HANTE преди 6 дни
родител
ревизия
d6045139b5
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      its-cluster/src/main/java/com/its/common/cluster/vo/AbstractHaClusterConfig.java

+ 9 - 1
its-cluster/src/main/java/com/its/common/cluster/vo/AbstractHaClusterConfig.java

@@ -60,6 +60,9 @@ public abstract class AbstractHaClusterConfig {
     }
 
     private String getStringValue(String item, String defValue) throws IOException {
+        if (!this.enabled) {
+            return defValue;
+        }
         Pattern stringPattern = Pattern.compile(item + "=([a-zA-Z0-9]+)");
         try (BufferedReader reader = new BufferedReader(new FileReader(this.configFile))) {
             String line;
@@ -74,6 +77,9 @@ public abstract class AbstractHaClusterConfig {
     }
 
     private int getIntValue(String item, int defValue) throws IOException {
+        if (!this.enabled) {
+            return defValue;
+        }
         Pattern serverIdPattern = Pattern.compile(item+"=(\\d+)");
         try (BufferedReader reader = new BufferedReader(new FileReader(this.configFile))) {
             String line;
@@ -110,7 +116,9 @@ public abstract class AbstractHaClusterConfig {
         if (this.syncSeconds > 60) {
             this.syncSeconds = 60;
         }
-
+        if (!this.enabled) {
+            return;
+        }
         Pattern serverPattern = Pattern.compile("server\\.(\\d+)=([\\d\\.]+):(\\d+)");
 //        Pattern pattern = Pattern.compile("server\\.(\\d+)=([\\d\\.]+):(\\d+):(\\d+)");
         int masterId = Integer.MAX_VALUE;