|
@@ -21,7 +21,8 @@ import com.saga.util.HBaseUtil;
|
|
|
|
|
|
public class CollectThread extends Thread {
|
|
|
private int port = 0;
|
|
|
- private long getPointList = 0;
|
|
|
+ // private long getPointList = 0;
|
|
|
+ private Map<String, Long> getPointList = new HashMap<String, Long>();
|
|
|
private String ip = null;
|
|
|
// private List<IServerManager> serverList = new
|
|
|
// ArrayList<IServerManager>();
|
|
@@ -259,6 +260,7 @@ public class CollectThread extends Thread {
|
|
|
// LogUtil.info(server.Name() + " PopRece.Split:" +
|
|
|
// p.address + " " + s);
|
|
|
String[] rList = s.split(";");
|
|
|
+
|
|
|
if ("report".equalsIgnoreCase(rList[2]) && rList.length > 7) {
|
|
|
// 1101070037;1;report;20010203040506;123;1001;2;11;3.1;12;3.2
|
|
|
Constant.pointMAC.put(rList[0] + "-" + rList[5], rList[1]);
|
|
@@ -411,14 +413,7 @@ public class CollectThread extends Thread {
|
|
|
// Date()));
|
|
|
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);
|
|
|
- }
|
|
|
+ this.getPointList(p.address, rList);
|
|
|
|
|
|
} else if ("pointcountack".equalsIgnoreCase(rList[2])) {
|
|
|
int count = Integer.valueOf(rList[5]);
|
|
@@ -530,6 +525,26 @@ public class CollectThread extends Thread {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void getPointList(String address, String[] rList) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ String key = rList[0] + "-" + rList[1];
|
|
|
+ Long getTime = 0l;
|
|
|
+ if (!this.getPointList.containsKey(key)) {
|
|
|
+ this.getPointList.put(key, getTime);
|
|
|
+ }
|
|
|
+ if (this.needGetPointList(this.getPointList.get(key))) {
|
|
|
+ LogUtil.warn(key + " needGetPointList true ...");
|
|
|
+ int id = Constant.getID();
|
|
|
+ for (IServerManager server : this.serverList.values()) {
|
|
|
+ server.AppendToSend(address,
|
|
|
+ new Packet(rList[0] + ";" + rList[1] + ";" + "pointcount" + ";" + "" + ";" + id));
|
|
|
+ LogUtil.info(server.Name() + " AppendToSend:" + address + " " + rList[0] + ";" + rList[1] + ";"
|
|
|
+ + "pointcount" + ";" + "" + ";" + id);
|
|
|
+ }
|
|
|
+ this.getPointList.put(key, System.currentTimeMillis());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// private void handlePacket(IServerManager server, PacketEntity p) {
|
|
|
// // TODO Auto-generated method stub
|
|
|
// try {
|
|
@@ -872,13 +887,11 @@ public class CollectThread extends Thread {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- private boolean needGetPointList() {
|
|
|
+ private boolean needGetPointList(Long getTime) {
|
|
|
// 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 ...");
|
|
|
+ LogUtil.info(System.currentTimeMillis() + " " + getTime + " "
|
|
|
+ + (System.currentTimeMillis() - getTime) / Constant.Millisecond.MINUTE_1);
|
|
|
+ if (System.currentTimeMillis() - getTime > Constant.Millisecond.MINUTE_5) {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|