Explorar el Código

避免heart生成过多pointlist请求。

Jay Lee hace 6 años
padre
commit
900afe9bab
Se han modificado 1 ficheros con 20 adiciones y 21 borrados
  1. 20 21
      collect/src/main/java/com/saga/thread/down/CollectThread.java

+ 20 - 21
collect/src/main/java/com/saga/thread/down/CollectThread.java

@@ -21,7 +21,7 @@ import com.saga.util.HBaseUtil;
 
 public class CollectThread extends Thread {
 	private int port = 0;
-	// private long getPointList = 0;
+	private long getPointList = 0;
 	private String ip = null;
 	// private List<IServerManager> serverList = new
 	// ArrayList<IServerManager>();
@@ -412,13 +412,13 @@ public class CollectThread extends Thread {
 						Constant.ps_PhysicalStatus.put(rList[0] + ";" + rList[1] + ";;;", System.currentTimeMillis());
 						// this.insertCollectorCommunicationLog(rList);
 
-						// if (this.needGetPointList()) {
-						int id = Constant.getID();
-						server.AppendToSend(p.address,
-								new Packet(rList[0] + ";" + rList[1] + ";" + "pointcount" + ";" + "" + ";" + id));
-						LogUtil.info(server.Name() + " AppendToSend:" + p.address + " " + rList[0] + ";" + rList[1]
-								+ ";" + "pointcount" + ";" + "" + ";" + id);
-						// }
+						if (this.needGetPointList()) {
+							int id = Constant.getID();
+							server.AppendToSend(p.address,
+									new Packet(rList[0] + ";" + rList[1] + ";" + "pointcount" + ";" + "" + ";" + id));
+							LogUtil.info(server.Name() + " AppendToSend:" + p.address + " " + rList[0] + ";" + rList[1]
+									+ ";" + "pointcount" + ";" + "" + ";" + id);
+						}
 
 					} else if ("pointcountack".equalsIgnoreCase(rList[2])) {
 						int count = Integer.valueOf(rList[5]);
@@ -872,19 +872,18 @@ public class CollectThread extends Thread {
 	// }
 	// }
 
-	// private boolean needGetPointList() {
-	// // TODO Auto-generated method stub
-	// LogUtil.error(System.currentTimeMillis() + " " + this.getPointList + " "
-	// + (System.currentTimeMillis() - this.getPointList) /
-	// Constant.Millisecond.MINUTE_1);
-	// if (System.currentTimeMillis() - this.getPointList >
-	// Constant.Millisecond.MINUTE_3) {
-	// this.getPointList = System.currentTimeMillis();
-	// LogUtil.error("needGetPointList true ...");
-	// return true;
-	// }
-	// return false;
-	// }
+	private boolean needGetPointList() {
+		// TODO Auto-generated method stub
+		LogUtil.info(System.currentTimeMillis() + " " + this.getPointList + " "
+				+ (System.currentTimeMillis() - this.getPointList) / Constant.Millisecond.MINUTE_1);
+		if (System.currentTimeMillis() - this.getPointList > Constant.Millisecond.MINUTE_3) {
+			this.getPointList = System.currentTimeMillis();
+			LogUtil.warn("needGetPointList true ...");
+			return true;
+		} else {
+			return false;
+		}
+	}
 
 	// private void insertCollectorStatus(String[] rList) {
 	// // TODO Auto-generated method stub