Browse Source

修复清空缓存造成的bug。

Jay Lee 6 years ago
parent
commit
50cfe93e8a

+ 1 - 1
collect/src/main/java/com/saga/thread/common/LoadConfigThread.java

@@ -30,7 +30,7 @@ public class LoadConfigThread extends Thread {
 	public void run() {
 		LogUtil.info("LoadConfigThread" + this.getName() + " Starting ...");
 		try {
-			Thread.sleep(Constant.Millisecond.MINUTE_30);
+			Thread.sleep(Constant.Millisecond.MINUTE_3);
 		} catch (InterruptedException e1) {
 			// TODO Auto-generated catch block
 			e1.printStackTrace();

+ 9 - 3
collect/src/main/java/com/saga/util/HBaseUtil.java

@@ -41,9 +41,15 @@ public class HBaseUtil {
 		wrapperObject.put("Datatable", tb);
 		wrapperObject.put("Criteria", Criteria);
 		LogUtil.info("Clear Project Point List:" + project + " Begin...");
-		Constant.ps_PhysicalList = new HashMap<String, List<String>>();
-		Constant.ps_ProjectList = new HashMap<String, List<String>>();
-		Constant.ps_MeterList = new HashMap<String, List<String>>();
+		synchronized (Constant.ps_PhysicalList) {
+			Constant.ps_PhysicalList = new HashMap<String, List<String>>();
+		}
+		synchronized (Constant.ps_ProjectList) {
+			Constant.ps_ProjectList = new HashMap<String, List<String>>();
+		}
+		synchronized (Constant.ps_MeterList) {
+			Constant.ps_MeterList = new HashMap<String, List<String>>();
+		}
 		LogUtil.info("Clear Project Point List:" + project + " End...");
 		LogUtil.info("Reload Project Point List:" + project + "  dy_pointlist Begin...");
 		JSONObject queryResult = agent.Query(wrapperObject);