Bläddra i källkod

多Zillion Agent 写入的支持。

Jay Lee 6 år sedan
förälder
incheckning
e208c63bb8

+ 2 - 1
collect/.classpath

@@ -50,8 +50,9 @@
 	<classpathentry kind="lib" path="mina-core-2.0.7.jar"/>
 	<classpathentry kind="lib" path="slf4j-api-1.6.1.jar"/>
 	<classpathentry kind="lib" path="slf4j-log4j12-1.6.1.jar"/>
-	<classpathentry kind="lib" path="zillion-util-1.5.jar"/>
 	<classpathentry kind="lib" path="poi-3.9.jar"/>
 	<classpathentry kind="lib" path="D:/develop/jdk1.6.0_35/lib/jxl.jar"/>
+	<classpathentry kind="lib" path="zillion-util-1.8.2.jar"/>
+	<classpathentry kind="lib" path="fastjson-1.1.33.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>

+ 9 - 9
collect/config.json

@@ -2,7 +2,7 @@
     "DB": [
         {
             "building": "1101080001", 
-            "database": "db_public_2", 
+            "database": "db_public_10", 
             "buildingadds": [
                 {
                     "building": "1101020001"
@@ -14,35 +14,35 @@
         }, 
         {
             "building": "1101080002", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "1101080003", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "1101080004", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "1101080005", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         },
         {
             "building": "1101050001", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "6666666666", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "7777777777", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "building": "3101140002", 
-            "database": "db_public_2"
+            "database": "db_public_10"
         }, 
         {
             "insertthread": "1"

BIN
collect/fastjson-1.1.33.jar


BIN
collect/pointlistadd.xls


+ 430 - 255
collect/src/main/java/com/saga/main/Main.java

@@ -3,6 +3,7 @@ package com.saga.main;
 import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -39,10 +40,11 @@ public class Main {
 		// TODO Auto-generated method stub
 		// 点位状态监控
 		try {
-			new CheckThread(Constant.agent).start();
+			new CheckThread().start();
+			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.CheckThread: " + e.toString());
+			LogUtil.error("Main.threadStart.CheckThread: " + e.toString());
 		}
 		// 配置实时加载进程
 		try {
@@ -50,20 +52,15 @@ public class Main {
 			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.LoadConfigThread: " + e.toString());
+			LogUtil.error("Main.threadStart.LoadConfigThread: " + e.toString());
 		}
 		// 采集进程
 		try {
-			String ports = Constant.TypePort.get("Down");
-			new CollectThread(Integer.valueOf(ports)).start();
-			// for (String p : ports.split(",")) {
-			// new CollectThread(Integer.valueOf(p)).start();
-			// }
-
+			new CollectThread(Integer.valueOf(Constant.TypePort.get("Down"))).start();
 			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.CollectThread: " + e.toString());
+			LogUtil.error("Main.threadStart.CollectThread: " + e.toString());
 		}
 		// 上传进程
 		List<IServerManager> udpserverList = new ArrayList<IServerManager>();
@@ -72,49 +69,51 @@ public class Main {
 		tcpserverList.add(new TCPServerManager("0.0.0.0", Integer.valueOf(Constant.TypePort.get("Up")), "utf-8", 1000));
 
 		for (IServerManager server : udpserverList) {
-			new SendThread(server).start();
 			try {
+				new SendThread(server).start();
 				Thread.sleep(3L);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("Main.SendThread: " + e.toString());
+				LogUtil.error("Main.threadStart.SendThread-UDP: " + e.toString());
 			}
 		}
 		for (IServerManager server : tcpserverList) {
-			new SendThread(server).start();
 			try {
+				new SendThread(server).start();
 				Thread.sleep(3L);
 			} catch (Exception e) {
 				// TODO Auto-generated catch block
-				LogUtil.error("Main.SendThread: " + e.toString());
+				LogUtil.error("Main.threadStart.SendThread-TCP: " + e.toString());
 			}
 		}
 		// 数据处理进程
 		try {
 			new SaveThread().start();
+			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.SaveThread: " + e.toString());
+			LogUtil.error("Main.threadStart.SaveThread: " + e.toString());
 		}
 		// 数据写库进程
 		try {
 			List<WTDBThread> wtdbthreadList = new ArrayList<WTDBThread>();
 			for (int i = 0; i < Constant.InsertThread; i++) {
-				WTDBThread thread = new WTDBThread(Constant.agent);
+				WTDBThread thread = new WTDBThread();
 				thread.start();
 				wtdbthreadList.add(thread);
 			}
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.WTDBThread: " + e.toString());
+			LogUtil.error("Main.threadStart.WTDBThread: " + e.toString());
 		}
 
 		// 统计进程
 		try {
 			new StatsThread().start();
+			Thread.sleep(3L);
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.StatsThread: " + e.toString());
+			LogUtil.error("Main.threadStart.StatsThread: " + e.toString());
 		}
 	}
 
@@ -122,7 +121,8 @@ public class Main {
 		// TODO Auto-generated method stub
 		try {
 			// ZillionAgent 启动
-			agentStart(args);
+			// agentStart(args);
+			agentsStart();
 			// 初始化数据库环境
 			initDB();
 			// 加载DB配置
@@ -171,64 +171,96 @@ public class Main {
 		// V2.0点位日志结构
 		{
 			// 先加载状态再加载列表,如无状态记录则根据列表生成null
-			loadStatus2();
-			loadPointList2();
-
+			// loadStatus2();
+			loadAgentsStatus2();
+			// loadPointList2();
+			loadAgentsPointList2();
 		}
-
 	}
+	//
+	// private static void loadPointList2() {
+	// // TODO Auto-generated method stub
+	// // 重新启动加载点位列表
+	// for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+	// try {
+	// String project = bd.getKey();
+	// String db = bd.getValue();
+	// HBaseUtil.LoadDB2Cache_dy_pointlist(Constant.agent, db, "dy_pointlist",
+	// project);
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// LogUtil.error("Main.loadPointList2: " + e.toString());
+	// }
+	// }
+	// }
 
-	private static void loadPointList2() {
+	private static void loadAgentsPointList2() {
 		// TODO Auto-generated method stub
 		// 重新启动加载点位列表
-		for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-			try {
-				String project = bd.getKey();
-				String db = bd.getValue();
-				HBaseUtil.LoadDB2Cache_dy_pointlist(Constant.agent, db, "dy_pointlist", project);
-
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				LogUtil.error("Main.loadPointList2: " + e.toString());
-			}
-		}
+		Constant.AgentsLoadDB2Cache_dy_pointlist();
 	}
+	// private static void loadStatus() {
+	// // TODO Auto-generated method stub
+	// // 重新启动加载节点、点位状态
+	// for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+	// try {
+	// String project = bd.getKey();
+	// String db = bd.getValue();
+	// HBaseUtil.GetCollectorStatus(Constant.agent, db, "pointgatewaystatus",
+	// project);
+	// HBaseUtil.GetPointStatus(Constant.agent, db, "pointstatus", project);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// LogUtil.error("Main.loadStatus: " + e.toString());
+	// }
+	// }
+	// }
+	//
+	// private static void loadStatus2() {
+	// // TODO Auto-generated method stub
+	// // 重新启动加载节点、点位状态
+	// for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+	// try {
+	// String project = bd.getKey();
+	// String db = bd.getValue();
+	// HBaseUtil.LoadDB2Cache_ps_physical_status(Constant.agent, db,
+	// "ps_physical_status", project);
+	// HBaseUtil.LoadDB2Cache_ps_virtual_meter_status(Constant.agent, db,
+	// "ps_virtual_meter_status", project);
+	// HBaseUtil.LoadDB2Cache_ps_virtual_point_status(Constant.agent, db,
+	// "ps_virtual_point_status", project);
+	// HBaseUtil.LoadDB2Cache_ps_virtual_project_status(Constant.agent, db,
+	// "ps_virtual_project_status",
+	// project);
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// LogUtil.error("Main.loadStatus2: " + e.toString());
+	// }
+	// }
+	// }
 
-//	private static void loadStatus() {
-//		// TODO Auto-generated method stub
-//		// 重新启动加载节点、点位状态
-//		for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-//			try {
-//				String project = bd.getKey();
-//				String db = bd.getValue();
-//				HBaseUtil.GetCollectorStatus(Constant.agent, db, "pointgatewaystatus", project);
-//				HBaseUtil.GetPointStatus(Constant.agent, db, "pointstatus", project);
-//			} catch (Exception e) {
-//				// TODO Auto-generated catch block
-//				e.printStackTrace();
-//				LogUtil.error("Main.loadStatus: " + e.toString());
-//			}
-//		}
-//	}
-
-	private static void loadStatus2() {
+	private static void loadAgentsStatus2() {
 		// TODO Auto-generated method stub
 		// 重新启动加载节点、点位状态
-		for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-			try {
-				String project = bd.getKey();
-				String db = bd.getValue();
-				HBaseUtil.LoadDB2Cache_ps_physical_status(Constant.agent, db, "ps_physical_status", project);
-				HBaseUtil.LoadDB2Cache_ps_virtual_meter_status(Constant.agent, db, "ps_virtual_meter_status", project);
-				HBaseUtil.LoadDB2Cache_ps_virtual_point_status(Constant.agent, db, "ps_virtual_point_status", project);
-				HBaseUtil.LoadDB2Cache_ps_virtual_project_status(Constant.agent, db, "ps_virtual_project_status",
-						project);
-
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				LogUtil.error("Main.loadStatus2: " + e.toString());
+		for (ZillionAgent agent : Constant.agents) {
+			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+				try {
+					String project = bd.getKey();
+					String db = bd.getValue();
+					HBaseUtil.LoadDB2Cache_ps_physical_status(agent, db, "ps_physical_status", project);
+					HBaseUtil.LoadDB2Cache_ps_virtual_meter_status(agent, db, "ps_virtual_meter_status", project);
+					HBaseUtil.LoadDB2Cache_ps_virtual_point_status(agent, db, "ps_virtual_point_status", project);
+					HBaseUtil.LoadDB2Cache_ps_virtual_project_status(agent, db, "ps_virtual_project_status", project);
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+					LogUtil.error("Main.loadAgentsStatus2: " + e.toString());
+				}
 			}
 		}
 	}
@@ -243,7 +275,9 @@ public class Main {
 		for (String db : dbList.keySet()) {
 			try {
 
-				createDB(db);
+				// createDB(db);
+				createAgentsDB(db);
+				Thread.sleep(Constant.Millisecond.SECOND_1);
 
 				// // V1.0点位日志结构
 				// {
@@ -257,219 +291,360 @@ public class Main {
 				{
 					// dropTB2(db);
 					// Thread.sleep(Constant.Millisecond.SECOND_1);
-					createTB2(db);
+					// createTB2(db);
+					createAgentsTB2(db);
 				}
 
 				Thread.sleep(Constant.Millisecond.SECOND_1);
 			} catch (InterruptedException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
-
 			}
 		}
 	}
 
-	private static void createTB2(String db) {
-		// TODO Auto-generated method stub
-		try {
-			HBaseUtil.CreateTable(Constant.agent, db, "original_month");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_present(Constant.agent, db, "original_present");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_set(Constant.agent, db, "originalset");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_setpresent(Constant.agent, db, "originalset_present");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			// dy_pointlist
-			HBaseUtil.CreateTable_dy_pointlist(Constant.agent, db, "dy_pointlist");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			// fjd_0_buildingcomputetime
-			HBaseUtil.CreateTable_fjd_0_buildingcomputetime(Constant.agent, db, "fjd_0_buildingcomputetime");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_physical_status
-			HBaseUtil.CreateTable_ps_physical_status(Constant.agent, db, "ps_physical_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_physical_log
-			HBaseUtil.CreateTable_ps_physical_log(Constant.agent, db, "ps_physical_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_point_status
-			HBaseUtil.CreateTable_ps_virtual_point_status(Constant.agent, db, "ps_virtual_point_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_point_log
-			HBaseUtil.CreateTable_ps_virtual_point_log(Constant.agent, db, "ps_virtual_point_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_meter_status
-			HBaseUtil.CreateTable_ps_virtual_meter_status(Constant.agent, db, "ps_virtual_meter_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_meter_log
-			HBaseUtil.CreateTable_ps_virtual_meter_log(Constant.agent, db, "ps_virtual_meter_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_project_status
-			HBaseUtil.CreateTable_ps_virtual_project_status(Constant.agent, db, "ps_virtual_project_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_project_log
-			HBaseUtil.CreateTable_ps_virtual_project_log(Constant.agent, db, "ps_virtual_project_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			Thread.sleep(Constant.Millisecond.SECOND_30);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private static void createTB2(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// HBaseUtil.CreateTable(Constant.agent, db, "original_month");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_present(Constant.agent, db, "original_present");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_set(Constant.agent, db, "originalset");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_setpresent(Constant.agent, db,
+	// "originalset_present");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // dy_pointlist
+	// HBaseUtil.CreateTable_dy_pointlist(Constant.agent, db, "dy_pointlist");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // fjd_0_buildingcomputetime
+	// HBaseUtil.CreateTable_fjd_0_buildingcomputetime(Constant.agent, db,
+	// "fjd_0_buildingcomputetime");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_physical_status
+	// HBaseUtil.CreateTable_ps_physical_status(Constant.agent, db,
+	// "ps_physical_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_physical_log
+	// HBaseUtil.CreateTable_ps_physical_log(Constant.agent, db,
+	// "ps_physical_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_point_status
+	// HBaseUtil.CreateTable_ps_virtual_point_status(Constant.agent, db,
+	// "ps_virtual_point_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_point_log
+	// HBaseUtil.CreateTable_ps_virtual_point_log(Constant.agent, db,
+	// "ps_virtual_point_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_meter_status
+	// HBaseUtil.CreateTable_ps_virtual_meter_status(Constant.agent, db,
+	// "ps_virtual_meter_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_meter_log
+	// HBaseUtil.CreateTable_ps_virtual_meter_log(Constant.agent, db,
+	// "ps_virtual_meter_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_project_status
+	// HBaseUtil.CreateTable_ps_virtual_project_status(Constant.agent, db,
+	// "ps_virtual_project_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_project_log
+	// HBaseUtil.CreateTable_ps_virtual_project_log(Constant.agent, db,
+	// "ps_virtual_project_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// Thread.sleep(Constant.Millisecond.SECOND_30);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// LogUtil.error("Main.createTB2: " + e.toString());
+	// }
+	// }
 
-	private static void dropTB2(String db) {
+	private static void createAgentsTB2(String db) {
 		// TODO Auto-generated method stub
-		try {
-			// Constant.agent.DDL_DropTable(db, "original_month");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "original_present");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "originalset");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "originalset_present");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// // dy_pointlist
-			// Constant.agent.DDL_DropTable(db, "dy_pointlist");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_physical_status
-			Constant.agent.DDL_DropTable(db, "ps_physical_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_physical_log
-			Constant.agent.DDL_DropTable(db, "ps_physical_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_point_status
-			Constant.agent.DDL_DropTable(db, "ps_virtual_point_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_point_log
-			Constant.agent.DDL_DropTable(db, "ps_virtual_point_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_meter_status
-			Constant.agent.DDL_DropTable(db, "ps_virtual_meter_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_meter_log
-			Constant.agent.DDL_DropTable(db, "ps_virtual_meter_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_project_status
-			Constant.agent.DDL_DropTable(db, "ps_virtual_project_status");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			// ps_virtual_project_log
-			Constant.agent.DDL_DropTable(db, "ps_virtual_project_log");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-
-			Thread.sleep(Constant.Millisecond.SECOND_30);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				// original_month
+				HBaseUtil.CreateTable(agent, db, "original_month");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+				// original_present
+				HBaseUtil.CreateTable_present(agent, db, "original_present");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+				// originalset
+				HBaseUtil.CreateTable_set(agent, db, "originalset");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+				// originalset_present
+				HBaseUtil.CreateTable_setpresent(agent, db, "originalset_present");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+				// dy_pointlist
+				HBaseUtil.CreateTable_dy_pointlist(agent, db, "dy_pointlist");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+				// fjd_0_buildingcomputetime
+				HBaseUtil.CreateTable_fjd_0_buildingcomputetime(agent, db, "fjd_0_buildingcomputetime");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_physical_status
+				HBaseUtil.CreateTable_ps_physical_status(agent, db, "ps_physical_status");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_physical_log
+				HBaseUtil.CreateTable_ps_physical_log(agent, db, "ps_physical_log");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_point_status
+				HBaseUtil.CreateTable_ps_virtual_point_status(agent, db, "ps_virtual_point_status");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_point_log
+				HBaseUtil.CreateTable_ps_virtual_point_log(agent, db, "ps_virtual_point_log");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_meter_status
+				HBaseUtil.CreateTable_ps_virtual_meter_status(agent, db, "ps_virtual_meter_status");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_meter_log
+				HBaseUtil.CreateTable_ps_virtual_meter_log(agent, db, "ps_virtual_meter_log");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_project_status
+				HBaseUtil.CreateTable_ps_virtual_project_status(agent, db, "ps_virtual_project_status");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				// ps_virtual_project_log
+				HBaseUtil.CreateTable_ps_virtual_project_log(agent, db, "ps_virtual_project_log");
+				Thread.sleep(Constant.Millisecond.SECOND_3);
+
+				Thread.sleep(Constant.Millisecond.SECOND_30);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				LogUtil.error("Main.init.initDB.createAgentsTB2: " + e.toString());
+			}
 		}
 	}
+	//
+	// private static void dropTB2(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// // Constant.agent.DDL_DropTable(db, "original_month");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "original_present");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "originalset");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "originalset_present");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // // dy_pointlist
+	// // Constant.agent.DDL_DropTable(db, "dy_pointlist");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_physical_status
+	// Constant.agent.DDL_DropTable(db, "ps_physical_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_physical_log
+	// Constant.agent.DDL_DropTable(db, "ps_physical_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_point_status
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_point_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_point_log
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_point_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_meter_status
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_meter_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_meter_log
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_meter_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_project_status
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_project_status");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// // ps_virtual_project_log
+	// Constant.agent.DDL_DropTable(db, "ps_virtual_project_log");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	//
+	// Thread.sleep(Constant.Millisecond.SECOND_30);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
-	private static void createTB(String db) {
-		// TODO Auto-generated method stub
-		try {
-			HBaseUtil.CreateTable(Constant.agent, db, "original_month");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_present(Constant.agent, db, "original_present");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_set(Constant.agent, db, "originalset");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_setpresent(Constant.agent, db, "originalset_present");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_CollectorStatus(Constant.agent, db, "pointgatewaystatus");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_CollectorCommunicationLog(Constant.agent, db, "pointgatewaylog");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_PointStatus(Constant.agent, db, "pointstatus");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_PointCommunicationLog(Constant.agent, db, "pointlog");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			HBaseUtil.CreateTable_PointInfo(Constant.agent, db, "pointinfo");
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private static void createTB(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// HBaseUtil.CreateTable(Constant.agent, db, "original_month");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_present(Constant.agent, db, "original_present");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_set(Constant.agent, db, "originalset");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_setpresent(Constant.agent, db,
+	// "originalset_present");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_CollectorStatus(Constant.agent, db,
+	// "pointgatewaystatus");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_CollectorCommunicationLog(Constant.agent, db,
+	// "pointgatewaylog");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_PointStatus(Constant.agent, db, "pointstatus");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_PointCommunicationLog(Constant.agent, db,
+	// "pointlog");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// HBaseUtil.CreateTable_PointInfo(Constant.agent, db, "pointinfo");
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
-	private static void dropTB(String db) {
-		// TODO Auto-generated method stub
-		try {
-			// Constant.agent.DDL_DropTable(db, "original_month");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "original_present");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "originalset");
-			// Thread.sleep(Constant.Millisecond.SECOND_3);
-			// Constant.agent.DDL_DropTable(db, "originalset_present");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			Constant.agent.DDL_DropTable(db, "collectorstatus");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			Constant.agent.DDL_DropTable(db, "collectorcommunicationlog");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			Constant.agent.DDL_DropTable(db, "pointstatus");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			Constant.agent.DDL_DropTable(db, "pointcommunicationlog");
-			Thread.sleep(Constant.Millisecond.SECOND_3);
-			Constant.agent.DDL_DropTable(db, "pointinfo");
-			Thread.sleep(Constant.Millisecond.SECOND_30);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private static void dropTB(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// // Constant.agent.DDL_DropTable(db, "original_month");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "original_present");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "originalset");
+	// // Thread.sleep(Constant.Millisecond.SECOND_3);
+	// // Constant.agent.DDL_DropTable(db, "originalset_present");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// Constant.agent.DDL_DropTable(db, "collectorstatus");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// Constant.agent.DDL_DropTable(db, "collectorcommunicationlog");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// Constant.agent.DDL_DropTable(db, "pointstatus");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// Constant.agent.DDL_DropTable(db, "pointcommunicationlog");
+	// Thread.sleep(Constant.Millisecond.SECOND_3);
+	// Constant.agent.DDL_DropTable(db, "pointinfo");
+	// Thread.sleep(Constant.Millisecond.SECOND_30);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
-	private static void createDB(String db) {
+	// private static void createDB(String db) {
+	// // TODO Auto-generated method stub
+	// try {
+	// HBaseUtil.CreateDB(Constant.agent, db);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
+
+	private static void createAgentsDB(String db) {
 		// TODO Auto-generated method stub
-		try {
-			HBaseUtil.CreateDB(Constant.agent, db);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.CreateDB(agent, db);
+				Thread.sleep(1000L);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 		}
 	}
 
-	private static void agentStart(String[] args) {
+	// private static void agentStart(String[] args) {
+	// // TODO Auto-generated method stub
+	// try {
+	// String resource = "/hbase-site.xml";
+	// Configuration configuration = new Configuration();
+	//
+	// configuration.addResource(new
+	// FileInputStream(System.getProperty("user.dir") + resource));
+	// String zookeeper_connectionAddress =
+	// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
+	//
+	// if (args != null && args.length > 0 && "test".equalsIgnoreCase(args[0]))
+	// {
+	// // zookeeper_connectionAddress =
+	// // "zk01.td.com:2181,zk02.td.com:2181,zk03.td.com:2181";
+	// zookeeper_connectionAddress = "zookeeper1,zookeeper2,zookeeper3";
+	// }
+	//
+	// int zookeeper_sessionTimeout = 300000;
+	// Constant.agent = new ZillionAgent(configuration,
+	// zookeeper_connectionAddress, zookeeper_sessionTimeout);
+	//
+	// Constant.agent.Start();
+	// // LogUtil.info("" + Constant.BuildingDB);
+	// // LogUtil.info("" + Constant.BuildingAdds);
+	// // LogUtil.info("" + Constant.BuildingConv);
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// LogUtil.error("Main.init.agentStart: " + e.toString());
+	// }
+	// }
+
+	private static void agentsStart() {
 		// TODO Auto-generated method stub
 		try {
-			String resource = "/hbase-site.xml";
-			Configuration configuration = new Configuration();
-
-			configuration.addResource(new FileInputStream(System.getProperty("user.dir") + resource));
-			String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
-
-			if (args != null && args.length > 0 && "test".equalsIgnoreCase(args[0])) {
-				// zookeeper_connectionAddress =
-				// "zk01.td.com:2181,zk02.td.com:2181,zk03.td.com:2181";
-				zookeeper_connectionAddress = "zookeeper1,zookeeper2,zookeeper3";
+			// String resource = "/hbase-site.xml";
+			// Configuration configuration = new Configuration();
+			// configuration.addResource(new
+			// FileInputStream(System.getProperty("user.dir") + resource));
+			// int zookeeper_sessionTimeout = 300000;
+
+			List<String> qrlist = new ArrayList<String>();
+			// qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
+			qrlist.add("zookeeper1,zookeeper2,zookeeper3");
+			qrlist.add("zookeeper1.saga");
+			// qrlist.add("zookeeper1");
+
+			for (String qr : qrlist) {
+				try {
+					Configuration configuration = new Configuration();
+					configuration.set("hbase.cluster.distributed", "true");
+					configuration.set("hbase.zookeeper.quorum", qr);
+					ZillionAgent agent = new ZillionAgent(configuration);
+					agent.setFull_name(qr);
+					agent.Start();
+					Constant.agents.add(agent);
+				} catch (Exception e) {
+					e.printStackTrace();
+					LogUtil.error("Main.init.agentsStart: " + e.toString());
+				}
 			}
-
-			int zookeeper_sessionTimeout = 300000;
-			Constant.agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
-
-			Constant.agent.Start();
-			// LogUtil.info("" + Constant.BuildingDB);
-			// LogUtil.info("" + Constant.BuildingAdds);
-			// LogUtil.info("" + Constant.BuildingConv);
+			// Constant.agents.add(new ZillionAgent(configuration,
+			// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
+			// zookeeper_sessionTimeout));
+			// Constant.agents
+			// .add(new ZillionAgent(configuration,
+			// "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
+			// Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
+			// zookeeper_sessionTimeout));
+			// Constant.agents.add(new ZillionAgent(configuration,
+			// "zookeeper1.saga", zookeeper_sessionTimeout));
 
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			LogUtil.error("Main.init.agentStart: " + e.toString());
+			LogUtil.error("Main.init.agentsStart: " + e.toString());
 		}
 	}
-
 }

+ 2 - 1
collect/src/main/java/com/saga/test/ShenQI.java

@@ -40,7 +40,8 @@ public class ShenQI {
 			configuration.addResource(new FileInputStream(System.getProperty("user.dir") + resource));
 			String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
 			int zookeeper_sessionTimeout = 300000;
-			agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
+			//agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
+			agent = new ZillionAgent(configuration);
 			agent.Start();
 			Thread.sleep(10L);
 			// ´´½¨HSSFWorkbook¶ÔÏó(excelµÄÎĵµ¶ÔÏó)

+ 3 - 1
collect/src/main/java/com/saga/test/Sunyifu.java

@@ -35,7 +35,9 @@ public class Sunyifu {
 			configuration.addResource(new FileInputStream(System.getProperty("user.dir") + resource));
 			String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
 			int zookeeper_sessionTimeout = 300000;
-			agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
+			// agent = new ZillionAgent(configuration,
+			// zookeeper_connectionAddress, zookeeper_sessionTimeout);
+			agent = new ZillionAgent(configuration);
 			agent.Start();
 			Thread.sleep(10L);
 			// for (int i = 0; i < 20; i++) {

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 535 - 443
collect/src/main/java/com/saga/test/Test.java


+ 108 - 93
collect/src/main/java/com/saga/thread/common/CheckThread.java

@@ -11,11 +11,9 @@ import java.util.Map.Entry;
 import org.zillion.util.log.LogUtil;
 
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
-import com.zillion.database.agent.ZillionAgent;
 
 public class CheckThread extends Thread {
-	ZillionAgent agent;
+	// ZillionAgent agent;
 	long realCheck = 0;
 	private String ip = null;
 	// private Map<String, String> nodeStatus = new HashMap<String, String>();
@@ -24,18 +22,15 @@ public class CheckThread extends Thread {
 	private Map<String, String> projectStatus = new HashMap<String, String>();
 	private Map<String, String> physicalStatus = new HashMap<String, String>();
 
-	public CheckThread(ZillionAgent agent) {
+	public CheckThread() {
 		try {
-			this.agent = agent;
-			try {
-				this.ip = Constant.getLocalHostLANAddress().getHostAddress() + ":" + Constant.TypePort.get("Down");
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
-				e.printStackTrace();
-			}
+			// this.agent = agent;
+			this.ip = Constant.getLocalHostLANAddress().getHostAddress() + ":" + Constant.TypePort.get("Down");
+
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
+			this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
+			e.printStackTrace();
 			LogUtil.error("CheckThread.Exception: " + e.toString());
 			System.exit(0);
 		}
@@ -43,12 +38,6 @@ public class CheckThread extends Thread {
 
 	public void run() {
 		LogUtil.info("CheckThread-" + this.getName() + " Starting ...");
-		// try {
-		// Thread.sleep(Constant.Millisecond.MINUTE_1);
-		// } catch (Exception e) {
-		// // TODO Auto-generated catch block
-		// e.printStackTrace();
-		// }
 		// 初次加载生成当前状态
 		this.excuteDBStatus();
 
@@ -155,25 +144,23 @@ public class CheckThread extends Thread {
 		synchronized (Constant.ps_ProjectList) {
 			for (Entry<String, List<String>> ps : Constant.ps_ProjectList.entrySet()) {
 				String project = ps.getKey();
-				List<String> l = ps.getValue();
-				String status = this.gatherStatus(l);
+				List<String> plist = ps.getValue();
+				String status = this.gatherStatus(plist);
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						HBaseUtil.Insert_ps_virtual_project_status(Constant.agent, Constant.BuildingDB.get(project),
-								project, status, Constant.format(new Date()), "");
+						Constant.Insert_agents_ps_virtual_project_status(project, status, Constant.format(new Date()),
+								"");
 					}
 
 					if (
 					// 首次
 					!this.projectStatus.containsKey(project) || null == this.projectStatus.get(project) ||
-					// 已有记录
+					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.projectStatus.get(project))) {
-
-						HBaseUtil.Insert_ps_virtual_project_log(Constant.agent, Constant.BuildingDB.get(project),
-								project, Constant.format(new Date()), status);
+						Constant.Insert_agents_ps_virtual_project_log(project, Constant.format(new Date()), status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							HBaseUtil.Insert_ps_virtual_project_status(Constant.agent, Constant.BuildingDB.get(project),
-									project, status, Constant.format(new Date()), "");
+							Constant.Insert_agents_ps_virtual_project_status(project, status,
+									Constant.format(new Date()), "");
 						}
 					}
 				} catch (Exception e) {
@@ -183,7 +170,6 @@ public class CheckThread extends Thread {
 				this.projectStatus.put(project, status);
 			}
 		}
-
 	}
 
 	private void virtual_meter_status_up_Check() {
@@ -191,28 +177,27 @@ public class CheckThread extends Thread {
 		synchronized (Constant.ps_MeterList) {
 			for (Entry<String, List<String>> ms : Constant.ps_MeterList.entrySet()) {
 				String pm = ms.getKey();
-				List<String> l = ms.getValue();
-				String status = this.gatherStatus(l);
+				List<String> plist = ms.getValue();
+				String status = this.gatherStatus(plist);
 				String[] ml = pm.split("-");
 				String project = ml[0];
 				String meter = ml[1];
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						HBaseUtil.Insert_ps_virtual_meter_status(Constant.agent, Constant.BuildingDB.get(project),
-								project, meter, "up", status, Constant.format(new Date()), "");
+						Constant.Insert_agents_ps_virtual_meter_status(project, meter, "up", status,
+								Constant.format(new Date()), "");
 					}
 
 					if (
 					// 首次
 					!this.meterStatus.containsKey(pm) || null == this.meterStatus.get(pm) ||
-					// 已有记录
+					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.meterStatus.get(pm))) {
-
-						HBaseUtil.Insert_ps_virtual_meter_log(Constant.agent, Constant.BuildingDB.get(project), project,
-								meter, "up", Constant.format(new Date()), status);
+						Constant.Insert_agents_ps_virtual_meter_log(project, meter, "up", Constant.format(new Date()),
+								status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							HBaseUtil.Insert_ps_virtual_meter_status(Constant.agent, Constant.BuildingDB.get(project),
-									project, meter, "up", status, Constant.format(new Date()), "");
+							Constant.Insert_agents_ps_virtual_meter_status(project, meter, "up", status,
+									Constant.format(new Date()), "");
 						}
 					}
 				} catch (Exception e) {
@@ -240,8 +225,8 @@ public class CheckThread extends Thread {
 				String address_4 = pl.length < 5 ? "" : pl[4];
 				String status = "disconn";
 				if (!physical.endsWith(";;;")) {
-					List<String> l = ps.getValue();
-					status = this.gatherStatus(l);
+					List<String> plist = ps.getValue();
+					status = this.gatherStatus(plist);
 				} else {
 					if (Constant.ps_PhysicalStatus.get(physical) != null) {
 						if (this.realCheck - Constant.ps_PhysicalStatus.get(physical) < Constant.Millisecond.MINUTE_1) {
@@ -253,22 +238,21 @@ public class CheckThread extends Thread {
 				}
 				try {
 					if ("conn".equalsIgnoreCase(status)) {
-						HBaseUtil.Insert_ps_physical_status(Constant.agent, Constant.BuildingDB.get(project), project,
-								address_1, address_2, address_3, address_4, status, Constant.format(new Date()), "");
+						Constant.Insert_agents_ps_physical_status(project, address_1, address_2, address_3, address_4,
+								status, Constant.format(new Date()), "");
 					}
 
 					if (
 					// 首次
 					!this.physicalStatus.containsKey(physical) || null == this.physicalStatus.get(physical) ||
-					// 已有记录
+					// 已有记录且状态发生变化
 							!status.equalsIgnoreCase(this.physicalStatus.get(physical))) {
+						Constant.Insert_agents_ps_physical_log(project, address_1, address_2, address_3, address_4,
+								Constant.format(new Date()), status);
 
-						HBaseUtil.Insert_ps_physical_log(Constant.agent, Constant.BuildingDB.get(project), project,
-								address_1, address_2, address_3, address_4, Constant.format(new Date()), status);
 						if ("disconn".equalsIgnoreCase(status)) {
-							HBaseUtil.Insert_ps_physical_status(Constant.agent, Constant.BuildingDB.get(project),
-									project, address_1, address_2, address_3, address_4, status,
-									Constant.format(new Date()), "");
+							Constant.Insert_agents_ps_physical_status(project, address_1, address_2, address_3,
+									address_4, status, Constant.format(new Date()), "");
 						}
 					}
 				} catch (Exception e) {
@@ -393,8 +377,12 @@ public class CheckThread extends Thread {
 			nk = new ArrayList<String>();
 			for (String s : ps) {
 				String[] a = s.split(";");
-				HBaseUtil.Insert_ps_virtual_point_status(Constant.agent, a[0], a[1], a[4], Long.valueOf(a[5]), a[6],
-						a[7], a[8], a[9]);
+
+				Constant.Insert_agents_ps_virtual_point_status(a[1], a[4], Long.valueOf(a[5]), a[6], a[7],
+						Constant.parse(a[8]).getTime(), a[9]);
+				// HBaseUtil.Insert_ps_virtual_point_status(Constant.agent,
+				// a[0], a[1], a[4], Long.valueOf(a[5]), a[6],
+				// a[7], a[8], a[9]);
 				Thread.sleep(1L);
 			}
 			ps = new ArrayList<String>();
@@ -451,8 +439,11 @@ public class CheckThread extends Thread {
 
 				}
 				if ("conn".equalsIgnoreCase(status)) {
-					this.Insert_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up", status,
-							pointUp.getValue(), "");
+					// this.Insert_ps_virtual_point_status(building, meter,
+					// Long.valueOf(funcid), "up", status,
+					// pointUp.getValue(), "");
+					Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up", status,
+							(pointUp.getValue()), "");
 				}
 
 				if (
@@ -460,24 +451,38 @@ public class CheckThread extends Thread {
 				!this.pointStatus.containsKey(pointUp.getKey()) || null == this.pointStatus.get(pointUp.getKey()))
 
 				{
-					this.Insert_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
+					// this.Insert_ps_virtual_point_log(building, meter,
+					// Long.valueOf(funcid), "up",
+					// System.currentTimeMillis(), 0l, status, "");
+					Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
 							System.currentTimeMillis(), 0l, status, "");
 					if ("disconn".equalsIgnoreCase(status)) {
-						this.Insert_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up", status,
-								pointUp.getValue(), "");
+						// this.Insert_ps_virtual_point_status(building, meter,
+						// Long.valueOf(funcid), "up", status,
+						// pointUp.getValue(), "");
+						Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up",
+								status, pointUp.getValue(), "");
 					}
 				} else if (
-				// 已有记录
+				// 已有记录且状态发生变化
 				(!status.equalsIgnoreCase(this.pointStatus.get(pointUp.getKey())))) {
 					// 添加Log记录
 					if (Constant.RecordAddress.containsKey(building + "-" + point.replace(".", "-"))) {
 						if (Constant.RecordAddress.get(building + "-" + point.replace(".", "-")) != null) {
 							int address = Constant.RecordAddress.get(building + "-" + point.replace(".", "-"));
-							this.Insert_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
+							// this.Insert_ps_virtual_point_log(building, meter,
+							// Long.valueOf(funcid), "up",
+							// pointUp.getValue(),
+							// Long.valueOf(Constant.RecordList.get(address).seq),
+							// status, "");
+							Constant.Insert_agents_ps_virtual_point_log(building, meter, Long.valueOf(funcid), "up",
 									pointUp.getValue(), Long.valueOf(Constant.RecordList.get(address).seq), status, "");
 							if ("disconn".equalsIgnoreCase(status)) {
-								this.Insert_ps_virtual_point_status(building, meter, Long.valueOf(funcid), "up", status,
-										pointUp.getValue(), "");
+								// this.Insert_ps_virtual_point_status(building,
+								// meter, Long.valueOf(funcid), "up", status,
+								// pointUp.getValue(), "");
+								Constant.Insert_agents_ps_virtual_point_status(building, meter, Long.valueOf(funcid),
+										"up", status, pointUp.getValue(), "");
 							}
 						}
 					}
@@ -492,22 +497,27 @@ public class CheckThread extends Thread {
 		}
 	}
 
-	private void Insert_ps_virtual_point_log(String building, String meter, Long funcid, String updown, Long time,
-			Long seq, String status, String feedback) {
-		// TODO Auto-generated method stub
-		try {
-			if (time == null) {
-				HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(building), building,
-						meter, Long.valueOf(funcid), updown, Constant.format(new Date()), seq, status, feedback);
-			} else {
-				HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(building), building,
-						meter, Long.valueOf(funcid), updown, Constant.format(new Date(time)), seq, status, feedback);
-			}
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private void Insert_ps_virtual_point_log(String building, String meter,
+	// Long funcid, String updown, Long time,
+	// Long seq, String status, String feedback) {
+	// // TODO Auto-generated method stub
+	// try {
+	// if (time == null) {
+	// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+	// Constant.BuildingDB.get(building), building,
+	// meter, Long.valueOf(funcid), updown, Constant.format(new Date()), seq,
+	// status, feedback);
+	// } else {
+	// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+	// Constant.BuildingDB.get(building), building,
+	// meter, Long.valueOf(funcid), updown, Constant.format(new Date(time)),
+	// seq, status, feedback);
+	// }
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
 	// private void physical_status_address_1_Check() {
 	// // TODO Auto-generated method stub
@@ -549,23 +559,28 @@ public class CheckThread extends Thread {
 	// }
 	// }
 
-	private void Insert_ps_virtual_point_status(String building, String meter, Long funcid, String updown,
-			String status, Long time, String detail) {
-		// TODO Auto-generated method stub
-		try {
-			if (time == null) {
-				HBaseUtil.Insert_ps_virtual_point_status(Constant.agent, Constant.BuildingDB.get(building), building,
-						meter, Long.valueOf(funcid), "up", status, Constant.format(new Date()), "");
-
-			} else {
-				HBaseUtil.Insert_ps_virtual_point_status(Constant.agent, Constant.BuildingDB.get(building), building,
-						meter, Long.valueOf(funcid), "up", status, Constant.format(new Date(time)), "");
-			}
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private void Insert_ps_virtual_point_status(String building, String
+	// meter, Long funcid, String updown,
+	// String status, Long time, String detail) {
+	// // TODO Auto-generated method stub
+	// try {
+	// if (time == null) {
+	// HBaseUtil.Insert_ps_virtual_point_status(Constant.agent,
+	// Constant.BuildingDB.get(building), building,
+	// meter, Long.valueOf(funcid), "up", status, Constant.format(new Date()),
+	// "");
+	//
+	// } else {
+	// HBaseUtil.Insert_ps_virtual_point_status(Constant.agent,
+	// Constant.BuildingDB.get(building), building,
+	// meter, Long.valueOf(funcid), "up", status, Constant.format(new
+	// Date(time)), "");
+	// }
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
 	// private void realCheck() {
 	// // TODO Auto-generated method stub

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

@@ -16,11 +16,11 @@ import com.saga.util.HBaseUtil;
 import com.zillion.database.agent.ZillionAgent;
 
 public class LoadConfigThread extends Thread {
-	ZillionAgent agent;
+	// ZillionAgent agent;
 
 	public LoadConfigThread() {
 		try {
-			this.agent = Constant.agent;
+			// this.agent = Constant.agent;
 
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
@@ -33,30 +33,30 @@ public class LoadConfigThread extends Thread {
 		LogUtil.info("LoadConfigThread" + this.getName() + " Starting ...");
 		try {
 			Thread.sleep(Constant.Millisecond.MINUTE_3);
+			while (true) {
+				try {
+					// 加载config配置文件
+					this.loadConfig();
+					// 加载DB点位列表
+					this.loadPointList2();
+					// 加载采集器配置文件
+					// this.loadCJQ();
+					Thread.sleep(Constant.Millisecond.MINUTE_5);
+
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					LogUtil.error("LoadConfigThread.run.Exception: " + e.toString());
+				}
+			}
 		} catch (InterruptedException e1) {
 			// TODO Auto-generated catch block
 			e1.printStackTrace();
 		}
-		while (true) {
-			try {
-				// 加载config配置文件
-				this.loadConfig();
-				// 加载DB点位列表
-				this.loadPointList2();
-				// 加载采集器配置文件
-				// this.loadCJQ();
-				Thread.sleep(Constant.Millisecond.MINUTE_5);
-
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				LogUtil.error("LoadConfigThread.run.Exception: " + e.toString());
-			}
-		}
 	}
 
 	private void loadPointList2() {
 		// TODO Auto-generated method stub
-		LogUtil.info("Clear Project Point List"  + " Begin...");
+		LogUtil.info("Clear Project Point List" + " Begin...");
 		synchronized (Constant.ps_PhysicalList) {
 			Constant.ps_PhysicalList = null;
 			Constant.ps_PhysicalList = new HashMap<String, List<String>>();
@@ -72,52 +72,55 @@ public class LoadConfigThread extends Thread {
 			Constant.ps_MeterList = new HashMap<String, List<String>>();
 			// Constant.ps_MeterList.clear();
 		}
-		LogUtil.info("Clear Project Point List"  + " End...");
-
-		for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
-			try {
-				String project = bd.getKey();
-				String db = bd.getValue();
-				HBaseUtil.LoadDB2Cache_dy_pointlist(Constant.agent, db, "dy_pointlist", project);
-
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				LogUtil.error("LoadConfigThread.loadPointList2: " + e.toString());
+		LogUtil.info("Clear Project Point List" + " End...");
+		for (ZillionAgent agent : Constant.agents) {
+			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+				try {
+					String project = bd.getKey();
+					String db = bd.getValue();
+					HBaseUtil.LoadDB2Cache_dy_pointlist(agent, db, "dy_pointlist", project);
+
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+					LogUtil.error("LoadConfigThread.loadPointList2: " + e.toString());
+				}
 			}
 		}
 	}
 
-	private void loadCJQ() {
-		// TODO Auto-generated method stub
-		// 文件夹命名格式:config+"-"+楼号+"-"+mac序号,示例:config-1101080002-1
-		Constant.getConfigFile(LogUtil.GetPath(), "config-", "port");
-		// 采集器点位位置信息写入数据库
-		for (Entry<String, String> pi : Constant.pointInfo.entrySet()) {
-			String building = pi.getKey().split("-")[0];
-			String mac = pi.getKey().split("-")[1];
-			String node = mac;
-			String point = pi.getKey().split("-")[2];
-			String busno = pi.getValue().split("-")[0];
-			String site = pi.getValue().split("-")[1];
-			try {
-				LogUtil.info(building + " " + node + " " + point + " " + busno + " " + site);
-				HBaseUtil.InsertPointInfo(Constant.agent, Constant.BuildingDB.get(building), building, node, point,
-						busno, site);
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			// System.out.println(building + node + point + busno +
-			// site);
-		}
-		try {
-			Thread.sleep(Constant.Millisecond.MINUTE_1);
-		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+	// private void loadCJQ() {
+	// // TODO Auto-generated method stub
+	// // 文件夹命名格式:config+"-"+楼号+"-"+mac序号,示例:config-1101080002-1
+	// Constant.getConfigFile(LogUtil.GetPath(), "config-", "port");
+	// // 采集器点位位置信息写入数据库
+	// for (Entry<String, String> pi : Constant.pointInfo.entrySet()) {
+	// String building = pi.getKey().split("-")[0];
+	// String mac = pi.getKey().split("-")[1];
+	// String node = mac;
+	// String point = pi.getKey().split("-")[2];
+	// String busno = pi.getValue().split("-")[0];
+	// String site = pi.getValue().split("-")[1];
+	// try {
+	// LogUtil.info(building + " " + node + " " + point + " " + busno + " " +
+	// site);
+	// HBaseUtil.InsertPointInfo(Constant.agent,
+	// Constant.BuildingDB.get(building), building, node, point,
+	// busno, site);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// // System.out.println(building + node + point + busno +
+	// // site);
+	// }
+	// try {
+	// Thread.sleep(Constant.Millisecond.MINUTE_1);
+	// } catch (InterruptedException e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 
 	private void loadConfig() {
 		// TODO Auto-generated method stub

+ 172 - 166
collect/src/main/java/com/saga/thread/common/SaveThread.java

@@ -130,7 +130,7 @@ public class SaveThread extends Thread {
 										if (!building.equalsIgnoreCase(b)) {
 											continue;
 										}
-										String mac = rList[1];
+										//String mac = rList[1];
 										String function = rList[2];
 										Date time = Constant.parse(rList[3]);
 										String meter = rList[5];
@@ -226,169 +226,175 @@ public class SaveThread extends Thread {
 	// + ";" + receivetime + ";" + addtion);
 	// }
 
-	private void handleCollectReportList1() {
-		// TODO Auto-generated method stub
-		try {
-			synchronized (Constant.CollectReportList) {
-
-				if (Constant.CollectReportList.size() > 0) {
-					// LogUtil.info("SaveThread Challenge
-					// Constant.CollectReportList
-					// begin...");
-					// synchronized (Constant.CollectReportList) {
-					// LogUtil.info("SaveThread Challenge
-					// Constant.CollectReportList get...");
-					// LogUtil.info("Constant.CollectReportList.size(): " +
-					// Constant.CollectReportList.size());
-					int no = 5000 > Constant.CollectReportList.size() ? Constant.CollectReportList.size() : 5000;
-					String b = Constant.CollectReportList.get(0).replace("(", "").replace(")", "").replace(" ", "");
-					if (b == null || b.length() == 0) {
-						Constant.CollectReportList.remove(0);
-						return;
-					}
-					b = Constant.CollectReportList.get(0).replace("(", "").replace(")", "").replace(" ", "")
-							.split(";")[0];
-					// if (Constant.RecordListToDB.size() > 0) {
-					// LogUtil.info("wait Constant.RecordListToDB begin");
-					// LogUtil.info("size:" + Constant.RecordListToDB.size()
-					// + "-->0");
-					// }
-					while (Constant.RecordListToDB.size() > 0) {
-						if (Constant.RecordListToDB.size() == 0) {
-							LogUtil.info("wait Constant.RecordListToDB end ");
-							break;
-						} else {
-							Thread.sleep(3L);
-							LogUtil.info(
-									"wait Constant.RecordListToDB.size:" + Constant.RecordListToDB.size() + "-->0");
-						}
-						Thread.sleep(1L);
-					}
-
-					// List<Record> recordList = new ArrayList<Record>();
-					this.strecordList.clear();
-					Iterator<String> it = Constant.CollectReportList.iterator();
-					int c = 0;
-					while (it.hasNext()) {
-						// LogUtil.info("Constant.CollectReportList deal " + c);
-						try {
-
-							String report = it.next().replace("(", "").replace(")", "").replace(" ", "");
-							if (c < no) {
-								if (report != null) {
-									String[] rList = report.replace("(", "").replace(")", "").replace(" ", "")
-											.split(";");
-									if (rList != null && rList.length > 8) {
-										String building = rList[0];
-										if (!building.equalsIgnoreCase(b)) {
-											continue;
-										}
-										String mac = rList[1];
-										String function = rList[2];
-										Date time = Constant.parse(rList[3]);
-										String meter = rList[5];
-										int count = Integer.valueOf(rList[6]);
-										// String id = rList[4];
-
-										for (int i = 0; i < count; i++) {
-											Record record = new Record();
-											if ("report".equalsIgnoreCase(function)) {
-												Constant.collectReportCount++;
-												record.funcID = Integer.valueOf(rList[7 + 2 * i]);
-												record.data = Double.valueOf(rList[8 + 2 * i]);
-												Constant.ps_PointStatusUp.put(
-														building + "-" + mac + "-" + meter + "." + record.funcID,
-														System.currentTimeMillis());
-												// // PointCommunicationLogÌí¼Ó¼Ç¼
-												// this.pointCommunicationList.add(building
-												// + ";" + this.ip + ";" + mac
-												// + ";" + meter + "." +
-												// record.funcID + ";" +
-												// function + ";" + id
-												// + ";" + rList[3] + ";" + "");
-											} else if ("reportaddtion".equalsIgnoreCase(function)) {
-												Constant.collectReportCount++;
-												record.funcID = Integer.valueOf(rList[7 + 3 * i]);
-												record.data = Double.valueOf(rList[8 + 3 * i]);
-												record.addtion = "null".equalsIgnoreCase(rList[9 + i * 3]) ? ""
-														: (rList[9 + i * 3]);
-												Constant.ps_PointStatusUp.put(
-														building + "-" + mac + "-" + meter + "." + record.funcID,
-														System.currentTimeMillis());
-												// // PointCommunicationLogÌí¼Ó¼Ç¼
-												// this.pointCommunicationList.add(building
-												// + ";" + this.ip + ";" + mac
-												// + ";" + meter + "." +
-												// record.funcID + ";" +
-												// function + ";" + id
-												// + ";" + rList[3] + ";" +
-												// record.addtion);
-												// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
-												// Constant.BuildingDB.get(building),
-												// building,
-												// Constant.getLocalHostLANAddress().getHostAddress(),
-												// mac,
-												// meter + "." + record.funcID,
-												// function, id, rList[3],
-												// record.addtion);
-
-											}
-
-											record.buildingSign = building;
-											record.meterSign = meter;
-											record.receivetime = time;
-
-											this.strecordList.add(record);
-
-										}
-										it.remove();
-										// LogUtil.info("HBase.BatchInsert "
-										// +
-										// report);
-									} else {
-										it.remove();
-									}
-
-								} else {
-									it.remove();
-								}
-							} else {
-								break;
-							}
-							c++;
-							Thread.sleep(1L);
-						} catch (Exception e) {
-							// TODO Auto-generated catch block
-							it.remove();
-							LogUtil.error("SaveThread.run.Exception: " + e.toString());
-						}
-					}
-				}
-			}
-			// LogUtil.info("SaveThread Challenge
-			// Constant.RecordListToDB begin...");
-			Constant.RecordListToDB.addAll(this.strecordList);
-			Constant.report2DBCount += this.strecordList.size();
-			this.strecordList.clear();
-			if (this.strecordList.size() > 0) {
-				this.strecordList = new ArrayList<Record>();
-				System.gc();
-			}
-			// LogUtil.info("SaveThread Challenge
-			// Constant.RecordListToDB realse...");
-			// HBaseUtil.BatchInsert(Constant.agent,
-			// Constant.BuildingDB.get(b), recordList);
-			// }
-			// LogUtil.info("SaveThread Challenge
-			// Constant.CollectReportList
-			// realse...");
-			Thread.sleep(1L);
-
-			// Thread.sleep(Constant.Millisecond.SECOND_1);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			LogUtil.error("SaveThread.run.Exception: " + e.toString());
-			// Constant.DBConn = false;
-		}
-	}
+	// private void handleCollectReportList1() {
+	// // TODO Auto-generated method stub
+	// try {
+	// synchronized (Constant.CollectReportList) {
+	//
+	// if (Constant.CollectReportList.size() > 0) {
+	// // LogUtil.info("SaveThread Challenge
+	// // Constant.CollectReportList
+	// // begin...");
+	// // synchronized (Constant.CollectReportList) {
+	// // LogUtil.info("SaveThread Challenge
+	// // Constant.CollectReportList get...");
+	// // LogUtil.info("Constant.CollectReportList.size(): " +
+	// // Constant.CollectReportList.size());
+	// int no = 5000 > Constant.CollectReportList.size() ?
+	// Constant.CollectReportList.size() : 5000;
+	// String b = Constant.CollectReportList.get(0).replace("(",
+	// "").replace(")", "").replace(" ", "");
+	// if (b == null || b.length() == 0) {
+	// Constant.CollectReportList.remove(0);
+	// return;
+	// }
+	// b = Constant.CollectReportList.get(0).replace("(", "").replace(")",
+	// "").replace(" ", "")
+	// .split(";")[0];
+	// // if (Constant.RecordListToDB.size() > 0) {
+	// // LogUtil.info("wait Constant.RecordListToDB begin");
+	// // LogUtil.info("size:" + Constant.RecordListToDB.size()
+	// // + "-->0");
+	// // }
+	// while (Constant.RecordListToDB.size() > 0) {
+	// if (Constant.RecordListToDB.size() == 0) {
+	// LogUtil.info("wait Constant.RecordListToDB end ");
+	// break;
+	// } else {
+	// Thread.sleep(3L);
+	// LogUtil.info(
+	// "wait Constant.RecordListToDB.size:" + Constant.RecordListToDB.size() +
+	// "-->0");
+	// }
+	// Thread.sleep(1L);
+	// }
+	//
+	// // List<Record> recordList = new ArrayList<Record>();
+	// this.strecordList.clear();
+	// Iterator<String> it = Constant.CollectReportList.iterator();
+	// int c = 0;
+	// while (it.hasNext()) {
+	// // LogUtil.info("Constant.CollectReportList deal " + c);
+	// try {
+	//
+	// String report = it.next().replace("(", "").replace(")", "").replace(" ",
+	// "");
+	// if (c < no) {
+	// if (report != null) {
+	// String[] rList = report.replace("(", "").replace(")", "").replace(" ",
+	// "")
+	// .split(";");
+	// if (rList != null && rList.length > 8) {
+	// String building = rList[0];
+	// if (!building.equalsIgnoreCase(b)) {
+	// continue;
+	// }
+	// String mac = rList[1];
+	// String function = rList[2];
+	// Date time = Constant.parse(rList[3]);
+	// String meter = rList[5];
+	// int count = Integer.valueOf(rList[6]);
+	// // String id = rList[4];
+	//
+	// for (int i = 0; i < count; i++) {
+	// Record record = new Record();
+	// if ("report".equalsIgnoreCase(function)) {
+	// Constant.collectReportCount++;
+	// record.funcID = Integer.valueOf(rList[7 + 2 * i]);
+	// record.data = Double.valueOf(rList[8 + 2 * i]);
+	// Constant.ps_PointStatusUp.put(
+	// building + "-" + mac + "-" + meter + "." + record.funcID,
+	// System.currentTimeMillis());
+	// // // PointCommunicationLogÌí¼Ó¼Ç¼
+	// // this.pointCommunicationList.add(building
+	// // + ";" + this.ip + ";" + mac
+	// // + ";" + meter + "." +
+	// // record.funcID + ";" +
+	// // function + ";" + id
+	// // + ";" + rList[3] + ";" + "");
+	// } else if ("reportaddtion".equalsIgnoreCase(function)) {
+	// Constant.collectReportCount++;
+	// record.funcID = Integer.valueOf(rList[7 + 3 * i]);
+	// record.data = Double.valueOf(rList[8 + 3 * i]);
+	// record.addtion = "null".equalsIgnoreCase(rList[9 + i * 3]) ? ""
+	// : (rList[9 + i * 3]);
+	// Constant.ps_PointStatusUp.put(
+	// building + "-" + mac + "-" + meter + "." + record.funcID,
+	// System.currentTimeMillis());
+	// // // PointCommunicationLogÌí¼Ó¼Ç¼
+	// // this.pointCommunicationList.add(building
+	// // + ";" + this.ip + ";" + mac
+	// // + ";" + meter + "." +
+	// // record.funcID + ";" +
+	// // function + ";" + id
+	// // + ";" + rList[3] + ";" +
+	// // record.addtion);
+	// // HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// // Constant.BuildingDB.get(building),
+	// // building,
+	// // Constant.getLocalHostLANAddress().getHostAddress(),
+	// // mac,
+	// // meter + "." + record.funcID,
+	// // function, id, rList[3],
+	// // record.addtion);
+	//
+	// }
+	//
+	// record.buildingSign = building;
+	// record.meterSign = meter;
+	// record.receivetime = time;
+	//
+	// this.strecordList.add(record);
+	//
+	// }
+	// it.remove();
+	// // LogUtil.info("HBase.BatchInsert "
+	// // +
+	// // report);
+	// } else {
+	// it.remove();
+	// }
+	//
+	// } else {
+	// it.remove();
+	// }
+	// } else {
+	// break;
+	// }
+	// c++;
+	// Thread.sleep(1L);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// it.remove();
+	// LogUtil.error("SaveThread.run.Exception: " + e.toString());
+	// }
+	// }
+	// }
+	// }
+	// // LogUtil.info("SaveThread Challenge
+	// // Constant.RecordListToDB begin...");
+	// Constant.RecordListToDB.addAll(this.strecordList);
+	// Constant.report2DBCount += this.strecordList.size();
+	// this.strecordList.clear();
+	// if (this.strecordList.size() > 0) {
+	// this.strecordList = new ArrayList<Record>();
+	// System.gc();
+	// }
+	// // LogUtil.info("SaveThread Challenge
+	// // Constant.RecordListToDB realse...");
+	// // HBaseUtil.BatchInsert(Constant.agent,
+	// // Constant.BuildingDB.get(b), recordList);
+	// // }
+	// // LogUtil.info("SaveThread Challenge
+	// // Constant.CollectReportList
+	// // realse...");
+	// Thread.sleep(1L);
+	//
+	// // Thread.sleep(Constant.Millisecond.SECOND_1);
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// LogUtil.error("SaveThread.run.Exception: " + e.toString());
+	// // Constant.DBConn = false;
+	// }
+	// }
 }

+ 6 - 6
collect/src/main/java/com/saga/thread/common/WTDBThread.java

@@ -12,20 +12,18 @@ import org.zillion.util.log.LogUtil;
 
 import com.saga.entity.Record;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
-import com.zillion.database.agent.ZillionAgent;
 
 public class WTDBThread extends Thread {
-	ZillionAgent agent;
+	// ZillionAgent agent;
 	long realCheck = 0;
 	// private String ip = null;
 	private List<Record> wtdbrecordList = new ArrayList<Record>();
 	// private Map<String, String> nodeStatus = new HashMap<String, String>();
 	// private Map<String, String> pointStatus = new HashMap<String, String>();
 
-	public WTDBThread(ZillionAgent agent) {
+	public WTDBThread() {
 		try {
-			this.agent = agent;
+			// this.agent = agent;
 			// try {
 			// this.ip = Constant.getLocalHostLANAddress().getHostAddress() +
 			// ":" + Constant.TypePort.get("Down");
@@ -68,7 +66,9 @@ public class WTDBThread extends Thread {
 					if (Constant.BuildingConv.containsKey(b)) {
 						b = Constant.BuildingConv.get(b);
 					}
-					HBaseUtil.BatchInsert(this.agent, Constant.BuildingDB.get(b), wtdbrecordList);
+					// HBaseUtil.BatchInsert(Constant.agent,
+					// Constant.BuildingDB.get(b), wtdbrecordList);
+					Constant.AgentsBatchInsert(Constant.BuildingDB.get(b), wtdbrecordList);
 					// LogUtil.info(this.getName() + " recordList size: " +
 					// recordList.size());
 					// LogUtil.info(this.getName() + " HBaseUtil.BatchInsert

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 50 - 26
collect/src/main/java/com/saga/thread/down/CollectThread.java


+ 382 - 299
collect/src/main/java/com/saga/thread/up/SendThread.java

@@ -1,6 +1,5 @@
 package com.saga.thread.up;
 
-import java.net.UnknownHostException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -14,24 +13,24 @@ import com.persagy.communication.util.IServerManager;
 import com.saga.entity.PointSet;
 import com.saga.entity.Record;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
 
 public class SendThread extends Thread {
 
 	private IServerManager uploadServer = null;
-	private String ip = null;
+	// private String ip = null;
 	private Map<String, String> pointMac_UP = new HashMap<String, String>();
 
 	public SendThread(IServerManager uploadServer) {
 		// TODO Auto-generated constructor stub
 		try {
-			try {
-				this.ip = Constant.getLocalHostLANAddress().getHostAddress() + ":" + Constant.TypePort.get("Down");
-			} catch (Exception e) {
-				// TODO Auto-generated catch block
-				this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
-				e.printStackTrace();
-			}
+			// try {
+			// // this.ip = Constant.getLocalHostLANAddress().getHostAddress()
+			// // + ":" + Constant.TypePort.get("Down");
+			// } catch (Exception e) {
+			// // TODO Auto-generated catch block
+			// // this.ip = "0.0.0.0" + ":" + Constant.TypePort.get("Down");
+			// e.printStackTrace();
+			// }
 			this.uploadServer = uploadServer;
 			this.uploadServer.Start();
 			LogUtil.info("SendThread" + ": " + this.uploadServer.Name() + " Created ...");
@@ -83,120 +82,133 @@ public class SendThread extends Thread {
 		}
 	}
 
-	private void returnPointSet() {
-		// TODO Auto-generated method stub
-		try {
-			synchronized (Constant.pointSetList) {
-				if (Constant.pointSetList.size() > 0) {
-					Iterator<PointSet> it = Constant.pointSetList.iterator();
-					while (it.hasNext()) {
-						StringBuffer sb = new StringBuffer();
-						PointSet ps = it.next();
-						// String address =
-						// Constant.CollectorPointSetList.get(ps.buildingSign +
-						// ";"
-						// + ps.ID + ";");
-						// String address = ps.address;
-
-						if (!ps.uploadName.equalsIgnoreCase(this.uploadServer.Name())) {
-							break;
-						}
-
-						if (ps.address == null) {
-							break;
-						}
-						String MAC = ps.mac;
-						if (this.pointMac_UP.containsKey(ps.buildingSignUP + "-" + ps.meterSign)) {
-							MAC = this.pointMac_UP.get(ps.buildingSignUP + "-" + ps.meterSign);
-						}
-						// 已得到控制设备的反馈状态,移除
-						if (ps.recTime > 0 && ps.sendTime > 0 && (ps.status != null && ps.status.length() > 0)) {
-							sb.append(ps.buildingSignUP).append(";").append(MAC).append(";").append("pointsetack")
-									.append(";").append(Constant.format(new Date())).append(";").append(ps.ID)
-									.append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
-									.append(ps.status).append(";");
-							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
-							Constant.sendSend += sb.toString().length();
-							HBaseUtil.BatchInsert_Set2(Constant.agent, Constant.BuildingDB.get(ps.buildingSign), ps);
-							LogUtil.info(
-									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
-
-							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
-							HBaseUtil.InsertPointCommunicationLog(Constant.agent,
-									Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, this.ip, ps.mac,
-									ps.meterSign, String.valueOf(ps.funcID), "down", "pointsetack",
-									String.valueOf(ps.ID), Constant.format(new Date()), "finish:finish:" + ps.status);
-							synchronized (Constant.ps_ID2Status) {
-								Constant.ps_ID2Status.put(id, "finish:finish:" + ps.status);
-							}
-
-							// CSVUtil.insert(Constant.setlog, new
-							// StringBuffer(Constant.format_Log(new Date())
-							// + ": "
-							// + ps.meterSign + "." + ps.funcID + " set " +
-							// ps.dataSet + " " + ps.status + "!"
-							// + " Consuming:" + (ps.recTime - ps.sendTime <
-							// 0 ? 0 : ps.recTime - ps.sendTime)
-							// + "ms!" + "\r\n"));
-							it.remove();
-
-						} // 超时未得到设备的反馈状态,移除
-						else if (ps.recTime == 0 && ps.sendTime > 0
-								&& (System.currentTimeMillis() - ps.sendTime > Constant.getWaitingtime())) {
-							sb.append(ps.buildingSignUP).append(";").append(MAC).append(";").append("pointsetack")
-									.append(";").append(Constant.format(new Date())).append(";").append(ps.ID)
-									.append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
-									.append("fail:timeout").append(";");
-							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
-							Constant.sendSend += sb.toString().length();
-							HBaseUtil.BatchInsert_Set3(Constant.agent, Constant.BuildingDB.get(ps.buildingSign), ps);
-							LogUtil.info(
-									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
-							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
-
-							// LogUtil.info("InsertPointCommunicationLog" + "
-							// begin");
-							HBaseUtil.InsertPointCommunicationLog(Constant.agent,
-									Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, this.ip, ps.mac,
-									ps.meterSign, String.valueOf(ps.funcID), "down", "pointsetack",
-									String.valueOf(ps.ID), Constant.format(new Date()),
-									"finish:finish:" + "fail:timeout");
-
-							synchronized (Constant.ps_ID2Status) {
-								Constant.ps_ID2Status.put(id, "finish:finish:" + "fail:timeout");
-							}
-							// LogUtil.info("InsertPointCommunicationLog" + "
-							// end");
-
-							// CSVUtil.insert(Constant.setlog,
-							// new StringBuffer(
-							// Constant.format_Log(new Date()) + ": " +
-							// ps.meterSign + "." + ps.funcID
-							// + " set " + ps.dataSet + " fail(timeout) " +
-							// "!" + " Consuming:"
-							// + (System.currentTimeMillis() - ps.sendTime)
-							// + "ms!" + "\r\n"));
-							it.remove();
-						}
-						if (sb.length() > 0) {
-							// Constant.CollectorPointSetList.remove(ps.buildingSign
-							// + ";" + ps.ID + ";");
-							break;
-							// CSVUtil.insert(Constant.setlog, new
-							// StringBuffer(Constant.format_Log(new Date())
-							// + ": "
-							// + this.uploadClient.Name() + " AppendToSend:
-							// " + sb.toString() + "\r\n"));
-						}
-					}
-				}
-			}
-
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			LogUtil.error("SendThread.returnPointSet.Exception: " + e.toString());
-		}
-	}
+	// private void returnPointSet() {
+	// // TODO Auto-generated method stub
+	// try {
+	// synchronized (Constant.pointSetList) {
+	// if (Constant.pointSetList.size() > 0) {
+	// Iterator<PointSet> it = Constant.pointSetList.iterator();
+	// while (it.hasNext()) {
+	// StringBuffer sb = new StringBuffer();
+	// PointSet ps = it.next();
+	// // String address =
+	// // Constant.CollectorPointSetList.get(ps.buildingSign +
+	// // ";"
+	// // + ps.ID + ";");
+	// // String address = ps.address;
+	//
+	// if (!ps.uploadName.equalsIgnoreCase(this.uploadServer.Name())) {
+	// break;
+	// }
+	//
+	// if (ps.address == null) {
+	// break;
+	// }
+	// String MAC = ps.mac;
+	// if (this.pointMac_UP.containsKey(ps.buildingSignUP + "-" + ps.meterSign))
+	// {
+	// MAC = this.pointMac_UP.get(ps.buildingSignUP + "-" + ps.meterSign);
+	// }
+	// // 已得到控制设备的反馈状态,移除
+	// if (ps.recTime > 0 && ps.sendTime > 0 && (ps.status != null &&
+	// ps.status.length() > 0)) {
+	// sb.append(ps.buildingSignUP).append(";").append(MAC).append(";").append("pointsetack")
+	// .append(";").append(Constant.format(new
+	// Date())).append(";").append(ps.ID)
+	// .append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
+	// .append(ps.status).append(";");
+	// this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
+	// Constant.sendSend += sb.toString().length();
+	// HBaseUtil.BatchInsert_Set2(Constant.agent,
+	// Constant.BuildingDB.get(ps.buildingSign), ps);
+	// LogUtil.info(
+	// this.uploadServer.Name() + " AppendToSend: " + ps.address + " " +
+	// sb.toString());
+	//
+	// String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, this.ip,
+	// ps.mac,
+	// ps.meterSign, String.valueOf(ps.funcID), "down", "pointsetack",
+	// String.valueOf(ps.ID), Constant.format(new Date()), "finish:finish:" +
+	// ps.status);
+	//
+	// synchronized (Constant.ps_ID2Status) {
+	// Constant.ps_ID2Status.put(id, "finish:finish:" + ps.status);
+	// }
+	//
+	// // CSVUtil.insert(Constant.setlog, new
+	// // StringBuffer(Constant.format_Log(new Date())
+	// // + ": "
+	// // + ps.meterSign + "." + ps.funcID + " set " +
+	// // ps.dataSet + " " + ps.status + "!"
+	// // + " Consuming:" + (ps.recTime - ps.sendTime <
+	// // 0 ? 0 : ps.recTime - ps.sendTime)
+	// // + "ms!" + "\r\n"));
+	// it.remove();
+	//
+	// } // 超时未得到设备的反馈状态,移除
+	// else if (ps.recTime == 0 && ps.sendTime > 0
+	// && (System.currentTimeMillis() - ps.sendTime >
+	// Constant.getWaitingtime())) {
+	// sb.append(ps.buildingSignUP).append(";").append(MAC).append(";").append("pointsetack")
+	// .append(";").append(Constant.format(new
+	// Date())).append(";").append(ps.ID)
+	// .append(";").append(ps.meterSign).append(";").append(ps.funcID).append(";")
+	// .append("fail:timeout").append(";");
+	// this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
+	// Constant.sendSend += sb.toString().length();
+	// HBaseUtil.BatchInsert_Set3(Constant.agent,
+	// Constant.BuildingDB.get(ps.buildingSign), ps);
+	// LogUtil.info(
+	// this.uploadServer.Name() + " AppendToSend: " + ps.address + " " +
+	// sb.toString());
+	// String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
+	//
+	// // LogUtil.info("InsertPointCommunicationLog" + "
+	// // begin");
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, this.ip,
+	// ps.mac,
+	// ps.meterSign, String.valueOf(ps.funcID), "down", "pointsetack",
+	// String.valueOf(ps.ID), Constant.format(new Date()),
+	// "finish:finish:" + "fail:timeout");
+	//
+	// synchronized (Constant.ps_ID2Status) {
+	// Constant.ps_ID2Status.put(id, "finish:finish:" + "fail:timeout");
+	// }
+	// // LogUtil.info("InsertPointCommunicationLog" + "
+	// // end");
+	//
+	// // CSVUtil.insert(Constant.setlog,
+	// // new StringBuffer(
+	// // Constant.format_Log(new Date()) + ": " +
+	// // ps.meterSign + "." + ps.funcID
+	// // + " set " + ps.dataSet + " fail(timeout) " +
+	// // "!" + " Consuming:"
+	// // + (System.currentTimeMillis() - ps.sendTime)
+	// // + "ms!" + "\r\n"));
+	// it.remove();
+	// }
+	// if (sb.length() > 0) {
+	// // Constant.CollectorPointSetList.remove(ps.buildingSign
+	// // + ";" + ps.ID + ";");
+	// break;
+	// // CSVUtil.insert(Constant.setlog, new
+	// // StringBuffer(Constant.format_Log(new Date())
+	// // + ": "
+	// // + this.uploadClient.Name() + " AppendToSend:
+	// // " + sb.toString() + "\r\n"));
+	// }
+	// }
+	// }
+	// }
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// LogUtil.error("SendThread.returnPointSet.Exception: " + e.toString());
+	// }
+	// }
 
 	private void handlePopRece2(PacketEntity packageRece) {
 		// TODO Auto-generated method stub
@@ -225,12 +237,15 @@ public class SendThread extends Thread {
 					// Constant.id2status.put(id, "processing:rcvd");
 
 					try {
-						HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(rList[0]),
-								rList[0], rList[5], Long.valueOf(rList[6]), this.getupdown(rList[2]),
-								Constant.format(new Date()), Long.valueOf(rList[4]), rList[2], "processing:rcvd");
-					} catch (UnknownHostException e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
+						// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+						// Constant.BuildingDB.get(rList[0]),
+						// rList[0], rList[5], Long.valueOf(rList[6]),
+						// this.getupdown(rList[2]),
+						// Constant.format(new Date()), Long.valueOf(rList[4]),
+						// rList[2], "processing:rcvd");
+						Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
+								this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]), rList[2],
+								"processing:rcvd");
 					} catch (Exception e1) {
 						// TODO Auto-generated catch block
 						e1.printStackTrace();
@@ -292,18 +307,29 @@ public class SendThread extends Thread {
 										+ sb.toString());
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "success");
-								HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], rList[5], Long.valueOf(rList[6]), this.getupdown(rList[2]),
-										Constant.format(new Date()), Long.valueOf(rList[4]), "pointreadack",
-										"finish:finish:" + "success");
-
+								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+								// Constant.BuildingDB.get(rList[0]),
+								// rList[0], rList[5], Long.valueOf(rList[6]),
+								// this.getupdown(rList[2]),
+								// Constant.format(new Date()),
+								// Long.valueOf(rList[4]), "pointreadack",
+								// "finish:finish:" + "success");
+								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
+										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
+										"pointreadack", "finish:finish:" + "success");
 							} else {
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "fail");
-								HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], rList[5], Long.valueOf(rList[6]), this.getupdown(rList[2]),
-										Constant.format(new Date()), Long.valueOf(rList[4]), "pointreadack",
-										"finish:finish:" + "fail");
+								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+								// Constant.BuildingDB.get(rList[0]),
+								// rList[0], rList[5], Long.valueOf(rList[6]),
+								// this.getupdown(rList[2]),
+								// Constant.format(new Date()),
+								// Long.valueOf(rList[4]), "pointreadack",
+								// "finish:finish:" + "fail");
+								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
+										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
+										"pointreadack", "finish:finish:" + "fail");
 							}
 
 						} catch (Exception e) {
@@ -321,18 +347,32 @@ public class SendThread extends Thread {
 										+ sb.toString());
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "success");
-								HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], rList[5], Long.valueOf(rList[6]), this.getupdown(rList[2]),
-										Constant.format(new Date()), Long.valueOf(rList[4]), "realtimepointdataack",
-										"finish:finish:" + "success");
+								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+								// Constant.BuildingDB.get(rList[0]),
+								// rList[0], rList[5], Long.valueOf(rList[6]),
+								// this.getupdown(rList[2]),
+								// Constant.format(new Date()),
+								// Long.valueOf(rList[4]),
+								// "realtimepointdataack",
+								// "finish:finish:" + "success");
+								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
+										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
+										"realtimepointdataack", "finish:finish:" + "success");
 
 							} else {
 								// Constant.id2status.put(id, "finish:finish:" +
 								// "fail");
-								HBaseUtil.Insert_ps_virtual_point_log(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], rList[5], Long.valueOf(rList[6]), this.getupdown(rList[2]),
-										Constant.format(new Date()), Long.valueOf(rList[4]), "realtimepointdataack",
-										"finish:finish:" + "fail");
+								// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+								// Constant.BuildingDB.get(rList[0]),
+								// rList[0], rList[5], Long.valueOf(rList[6]),
+								// this.getupdown(rList[2]),
+								// Constant.format(new Date()),
+								// Long.valueOf(rList[4]),
+								// "realtimepointdataack",
+								// "finish:finish:" + "fail");
+								Constant.Insert_agents_ps_virtual_point_log(rList[0], rList[5], Long.valueOf(rList[6]),
+										this.getupdown(rList[2]), System.currentTimeMillis(), Long.valueOf(rList[4]),
+										"realtimepointdataack", "finish:finish:" + "fail");
 							}
 
 						} catch (Exception e) {
@@ -379,14 +419,23 @@ public class SendThread extends Thread {
 									.append(ps.status).append(";");
 							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
 							Constant.sendSend += sb.toString().length();
-							HBaseUtil.BatchInsert_Set2(Constant.agent, Constant.BuildingDB.get(ps.buildingSign), ps);
+							// HBaseUtil.BatchInsert_Set2(Constant.agent,
+							// Constant.BuildingDB.get(ps.buildingSign), ps);
+							Constant.AgentsBatchInsert_Set2(Constant.BuildingDB.get(ps.buildingSign), ps);
 							LogUtil.info(
 									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
 
 							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
-							HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
-									Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, ps.meterSign,
-									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), Constant.format(new Date()),
+							// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+							// Constant.BuildingDB.get(ps.buildingSignUP),
+							// ps.buildingSignUP, ps.meterSign,
+							// Long.valueOf(ps.funcID),
+							// this.getupdown("pointsetack"),
+							// Constant.format(new Date()),
+							// Long.valueOf(ps.ID), "pointsetack",
+							// "finish:finish:" + ps.status);
+							Constant.Insert_agents_ps_virtual_point_log(ps.buildingSignUP, ps.meterSign,
+									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), System.currentTimeMillis(),
 									Long.valueOf(ps.ID), "pointsetack", "finish:finish:" + ps.status);
 
 							synchronized (Constant.ps_ID2Status) {
@@ -412,16 +461,27 @@ public class SendThread extends Thread {
 									.append("fail:timeout").append(";");
 							this.uploadServer.AppendToSend(ps.address, new Packet(sb.toString()));
 							Constant.sendSend += sb.toString().length();
-							HBaseUtil.BatchInsert_Set3(Constant.agent, Constant.BuildingDB.get(ps.buildingSign), ps);
+							// HBaseUtil.BatchInsert_Set3(Constant.agent,
+							// Constant.BuildingDB.get(ps.buildingSign), ps);
+							Constant.AgentsBatchInsert_Set3(Constant.BuildingDB.get(ps.buildingSign), ps);
+
 							LogUtil.info(
 									this.uploadServer.Name() + " AppendToSend: " + ps.address + " " + sb.toString());
 							String id = ps.buildingSignUP + "-" + ps.mac + "-" + ps.ID;
 
 							// LogUtil.info("InsertPointCommunicationLog" + "
 							// begin");
-							HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
-									Constant.BuildingDB.get(ps.buildingSignUP), ps.buildingSignUP, ps.meterSign,
-									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), Constant.format(new Date()),
+							// HBaseUtil.Insert_ps_virtual_point_log(Constant.agent,
+							// Constant.BuildingDB.get(ps.buildingSignUP),
+							// ps.buildingSignUP, ps.meterSign,
+							// Long.valueOf(ps.funcID),
+							// this.getupdown("pointsetack"),
+							// Constant.format(new Date()),
+							// Long.valueOf(ps.ID), "pointsetack",
+							// "finish:finish:" + "fail:timeout");
+
+							Constant.Insert_agents_ps_virtual_point_log(ps.buildingSignUP, ps.meterSign,
+									Long.valueOf(ps.funcID), this.getupdown("pointsetack"), System.currentTimeMillis(),
 									Long.valueOf(ps.ID), "pointsetack", "finish:finish:" + "fail:timeout");
 
 							synchronized (Constant.ps_ID2Status) {
@@ -460,150 +520,173 @@ public class SendThread extends Thread {
 		}
 	}
 
-	private void handlePopRece(PacketEntity packageRece) {
-		// TODO Auto-generated method stub
-		if ((packageRece != null) && (packageRece.content.packetString != null)
-				&& (packageRece.content.packetString.length() > 0)) {
-			LogUtil.info(this.uploadServer.Name() + " PopRece: " + packageRece.address + " "
-					+ packageRece.content.packetString);
-			Constant.sendRec += packageRece.content.packetString.length();
-			String results = packageRece.content.packetString.replace("(", "").replace(")", "").replace(" ", "");
-			String[] resultArray = results.split("&");
-
-			for (String result : resultArray) {
-				String[] rList = result.split(";");
-				if (rList.length > 6) {
-					String MAC = rList[1];
-
-					if (Constant.pointMAC.containsKey(rList[0] + "-" + rList[5])) {
-						MAC = Constant.pointMAC.get(rList[0] + "-" + rList[5]);
-						LogUtil.info("MAC:" + (rList[0] + "-" + rList[5]) + " " + rList[1] + "-->" + MAC);
-					}
-					String id = rList[0] + "-" + MAC + "-" + rList[4];
-					String key = rList[0] + "-" + MAC + "-" + rList[5] + "." + rList[6];
-					// Constant.id2time.put(id, System.currentTimeMillis());
-					// Constant.id2point.put(id, key);
-					// Constant.id2function.put(id, rList[2]);
-					// Constant.id2status.put(id, "processing:rcvd");
-
-					try {
-						HBaseUtil.InsertPointCommunicationLog(Constant.agent, Constant.BuildingDB.get(rList[0]),
-								rList[0], this.ip, MAC, rList[5], (rList[6]), this.getupdown(rList[2]), rList[2],
-								String.valueOf(rList[4]), Constant.format(new Date()), "processing:rcvd");
-					} catch (UnknownHostException e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					} catch (Exception e1) {
-						// TODO Auto-generated catch block
-						e1.printStackTrace();
-					}
-
-					if ("pointset".equalsIgnoreCase(rList[2])) {
-						// 1101070037;1;pointset;;123;1001;11;3.1
-						synchronized (Constant.ps_ID2Time) {
-							Constant.ps_ID2Time.put(id, System.currentTimeMillis());
-						}
-						synchronized (Constant.ps_ID2Point) {
-							Constant.ps_ID2Point.put(id, key);
-						}
-						synchronized (Constant.ps_ID2Function) {
-							Constant.ps_ID2Function.put(id, rList[2]);
-						}
-						synchronized (Constant.ps_ID2Status) {
-							Constant.ps_ID2Status.put(id, "processing:rcvd");
-						}
-
-						PointSet ps = new PointSet();
-						ps.uploadName = this.uploadServer.Name();
-						ps.address = packageRece.address;
-						ps.content = rList;
-						ps.sendTime = 0;
-						ps.recTime = 0;
-						ps.buildingSign = rList[0];
-						ps.buildingSignUP = rList[0];
-						// 楼号有转换规则,且转换后的楼-表有数据才进行转换
-						// 解决一楼多楼号时总有部分仪表无法下发的问题
-						if (Constant.BuildingConv.containsKey(ps.buildingSign) && Constant.Meter_Collector_Control
-								.containsKey(Constant.BuildingConv.get(ps.buildingSign) + "-" + ps.meterSign)) {
-							ps.buildingSign = Constant.BuildingConv.get(ps.buildingSign);
-						}
-
-						ps.ID = Integer.valueOf(rList[4]);
-						ps.meterSign = rList[5];
-						ps.mac = MAC;
-						this.pointMac_UP.put(ps.buildingSignUP + "-" + ps.meterSign, rList[1]);
-						ps.funcID = Integer.valueOf(rList[6]);
-						ps.dataSet = Double.valueOf(rList[7]);
-						// String adress = packageRece.address;
-						// String cmd = ps.buildingSign + ";" + ps.ID + ";";
-						// +ps.meterSign + ";" + ps.funcID + ";"
-						// + ps.dataSet;
-
-						// Constant.CollectorPointSetList.put(cmd, adress);
-						synchronized (Constant.pointSetList) {
-							Constant.pointSetList.add(ps);
-						}
-
-					} else if (rList.length > 6 && "pointread".equalsIgnoreCase(rList[2])) {
-						try {
-							StringBuffer sb = new StringBuffer();
-							sb = this.getCacheData(rList);
-							if (sb != null && sb.toString().length() > 0) {
-								this.uploadServer.AppendToSend(packageRece.address, new Packet(sb.toString()));
-								LogUtil.info(this.uploadServer.Name() + " AppendToSend: " + packageRece.address + " "
-										+ sb.toString());
-								// Constant.id2status.put(id, "finish:finish:" +
-								// "success");
-								HBaseUtil.InsertPointCommunicationLog(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], this.ip, rList[1], rList[5], (rList[6]), "down", "pointreadack",
-										String.valueOf(rList[4]), Constant.format(new Date()),
-										"finish:finish:" + "success");
-							} else {
-								// Constant.id2status.put(id, "finish:finish:" +
-								// "fail");
-								HBaseUtil.InsertPointCommunicationLog(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], this.ip, rList[1], rList[5], (rList[6]), "down", "pointreadack",
-										String.valueOf(rList[4]), Constant.format(new Date()),
-										"finish:finish:" + "fail");
-							}
-
-						} catch (Exception e) {
-							e.printStackTrace();
-							LogUtil.error("SendThread.handlePopRece.pointread.Exception: " + e.toString());
-						}
-
-					} else if (rList.length > 6 && "realtimepointdata".equalsIgnoreCase(rList[2])) {
-						try {
-							StringBuffer sb = new StringBuffer();
-							sb = this.getCacheData2(rList);
-							if (sb != null && sb.toString().length() > 0) {
-								this.uploadServer.AppendToSend(packageRece.address, new Packet(sb.toString()));
-								LogUtil.info(this.uploadServer.Name() + " AppendToSend: " + packageRece.address + " "
-										+ sb.toString());
-								// Constant.id2status.put(id, "finish:finish:" +
-								// "success");
-								HBaseUtil.InsertPointCommunicationLog(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
-										"realtimepointdataack", String.valueOf(rList[4]), Constant.format(new Date()),
-										"finish:finish:" + "success");
-							} else {
-								// Constant.id2status.put(id, "finish:finish:" +
-								// "fail");
-								HBaseUtil.InsertPointCommunicationLog(Constant.agent, Constant.BuildingDB.get(rList[0]),
-										rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
-										"realtimepointdataack", String.valueOf(rList[4]), Constant.format(new Date()),
-										"finish:finish:" + "fail");
-							}
-
-						} catch (Exception e) {
-							e.printStackTrace();
-							LogUtil.error("SendThread.handlePopRece.realtimepointdata.Exception: " + e.toString());
-						}
-					}
-				}
-			}
-		}
-	}
+	// private void handlePopRece(PacketEntity packageRece) {
+	// // TODO Auto-generated method stub
+	// if ((packageRece != null) && (packageRece.content.packetString != null)
+	// && (packageRece.content.packetString.length() > 0)) {
+	// LogUtil.info(this.uploadServer.Name() + " PopRece: " +
+	// packageRece.address + " "
+	// + packageRece.content.packetString);
+	// Constant.sendRec += packageRece.content.packetString.length();
+	// String results = packageRece.content.packetString.replace("(",
+	// "").replace(")", "").replace(" ", "");
+	// String[] resultArray = results.split("&");
+	//
+	// for (String result : resultArray) {
+	// String[] rList = result.split(";");
+	// if (rList.length > 6) {
+	// String MAC = rList[1];
+	//
+	// if (Constant.pointMAC.containsKey(rList[0] + "-" + rList[5])) {
+	// MAC = Constant.pointMAC.get(rList[0] + "-" + rList[5]);
+	// LogUtil.info("MAC:" + (rList[0] + "-" + rList[5]) + " " + rList[1] +
+	// "-->" + MAC);
+	// }
+	// String id = rList[0] + "-" + MAC + "-" + rList[4];
+	// String key = rList[0] + "-" + MAC + "-" + rList[5] + "." + rList[6];
+	// // Constant.id2time.put(id, System.currentTimeMillis());
+	// // Constant.id2point.put(id, key);
+	// // Constant.id2function.put(id, rList[2]);
+	// // Constant.id2status.put(id, "processing:rcvd");
+	//
+	// try {
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(rList[0]),
+	// rList[0], this.ip, MAC, rList[5], (rList[6]), this.getupdown(rList[2]),
+	// rList[2],
+	// String.valueOf(rList[4]), Constant.format(new Date()),
+	// "processing:rcvd");
+	// } catch (UnknownHostException e1) {
+	// // TODO Auto-generated catch block
+	// e1.printStackTrace();
+	// } catch (Exception e1) {
+	// // TODO Auto-generated catch block
+	// e1.printStackTrace();
+	// }
+	//
+	// if ("pointset".equalsIgnoreCase(rList[2])) {
+	// // 1101070037;1;pointset;;123;1001;11;3.1
+	// synchronized (Constant.ps_ID2Time) {
+	// Constant.ps_ID2Time.put(id, System.currentTimeMillis());
+	// }
+	// synchronized (Constant.ps_ID2Point) {
+	// Constant.ps_ID2Point.put(id, key);
+	// }
+	// synchronized (Constant.ps_ID2Function) {
+	// Constant.ps_ID2Function.put(id, rList[2]);
+	// }
+	// synchronized (Constant.ps_ID2Status) {
+	// Constant.ps_ID2Status.put(id, "processing:rcvd");
+	// }
+	//
+	// PointSet ps = new PointSet();
+	// ps.uploadName = this.uploadServer.Name();
+	// ps.address = packageRece.address;
+	// ps.content = rList;
+	// ps.sendTime = 0;
+	// ps.recTime = 0;
+	// ps.buildingSign = rList[0];
+	// ps.buildingSignUP = rList[0];
+	// // 楼号有转换规则,且转换后的楼-表有数据才进行转换
+	// // 解决一楼多楼号时总有部分仪表无法下发的问题
+	// if (Constant.BuildingConv.containsKey(ps.buildingSign) &&
+	// Constant.Meter_Collector_Control
+	// .containsKey(Constant.BuildingConv.get(ps.buildingSign) + "-" +
+	// ps.meterSign)) {
+	// ps.buildingSign = Constant.BuildingConv.get(ps.buildingSign);
+	// }
+	//
+	// ps.ID = Integer.valueOf(rList[4]);
+	// ps.meterSign = rList[5];
+	// ps.mac = MAC;
+	// this.pointMac_UP.put(ps.buildingSignUP + "-" + ps.meterSign, rList[1]);
+	// ps.funcID = Integer.valueOf(rList[6]);
+	// ps.dataSet = Double.valueOf(rList[7]);
+	// // String adress = packageRece.address;
+	// // String cmd = ps.buildingSign + ";" + ps.ID + ";";
+	// // +ps.meterSign + ";" + ps.funcID + ";"
+	// // + ps.dataSet;
+	//
+	// // Constant.CollectorPointSetList.put(cmd, adress);
+	// synchronized (Constant.pointSetList) {
+	// Constant.pointSetList.add(ps);
+	// }
+	//
+	// } else if (rList.length > 6 && "pointread".equalsIgnoreCase(rList[2])) {
+	// try {
+	// StringBuffer sb = new StringBuffer();
+	// sb = this.getCacheData(rList);
+	// if (sb != null && sb.toString().length() > 0) {
+	// this.uploadServer.AppendToSend(packageRece.address, new
+	// Packet(sb.toString()));
+	// LogUtil.info(this.uploadServer.Name() + " AppendToSend: " +
+	// packageRece.address + " "
+	// + sb.toString());
+	// // Constant.id2status.put(id, "finish:finish:" +
+	// // "success");
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(rList[0]),
+	// rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
+	// "pointreadack",
+	// String.valueOf(rList[4]), Constant.format(new Date()),
+	// "finish:finish:" + "success");
+	// } else {
+	// // Constant.id2status.put(id, "finish:finish:" +
+	// // "fail");
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(rList[0]),
+	// rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
+	// "pointreadack",
+	// String.valueOf(rList[4]), Constant.format(new Date()),
+	// "finish:finish:" + "fail");
+	// }
+	//
+	// } catch (Exception e) {
+	// e.printStackTrace();
+	// LogUtil.error("SendThread.handlePopRece.pointread.Exception: " +
+	// e.toString());
+	// }
+	//
+	// } else if (rList.length > 6 &&
+	// "realtimepointdata".equalsIgnoreCase(rList[2])) {
+	// try {
+	// StringBuffer sb = new StringBuffer();
+	// sb = this.getCacheData2(rList);
+	// if (sb != null && sb.toString().length() > 0) {
+	// this.uploadServer.AppendToSend(packageRece.address, new
+	// Packet(sb.toString()));
+	// LogUtil.info(this.uploadServer.Name() + " AppendToSend: " +
+	// packageRece.address + " "
+	// + sb.toString());
+	// // Constant.id2status.put(id, "finish:finish:" +
+	// // "success");
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(rList[0]),
+	// rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
+	// "realtimepointdataack", String.valueOf(rList[4]), Constant.format(new
+	// Date()),
+	// "finish:finish:" + "success");
+	// } else {
+	// // Constant.id2status.put(id, "finish:finish:" +
+	// // "fail");
+	// HBaseUtil.InsertPointCommunicationLog(Constant.agent,
+	// Constant.BuildingDB.get(rList[0]),
+	// rList[0], this.ip, rList[1], rList[5], (rList[6]), "down",
+	// "realtimepointdataack", String.valueOf(rList[4]), Constant.format(new
+	// Date()),
+	// "finish:finish:" + "fail");
+	// }
+	//
+	// } catch (Exception e) {
+	// e.printStackTrace();
+	// LogUtil.error("SendThread.handlePopRece.realtimepointdata.Exception: " +
+	// e.toString());
+	// }
+	// }
+	// }
+	// }
+	// }
+	// }
 
 	private String getupdown(String function) {
 		// TODO Auto-generated method stub

+ 92 - 14
collect/src/main/java/com/saga/tool/ImportPoints.java

@@ -5,6 +5,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -14,7 +15,6 @@ import org.zillion.util.log.LogUtil;
 
 import com.saga.entity.EntityPoint;
 import com.saga.util.Constant;
-import com.saga.util.HBaseUtil;
 import com.zillion.database.agent.ZillionAgent;
 
 import jxl.Cell;
@@ -26,7 +26,8 @@ public class ImportPoints {
 
 	public static void main(String[] args) {
 		// TODO Auto-generated method stub
-		agentStart();
+		// agentStart();
+		agentsStart();
 		importPoints();
 		System.exit(0);
 	}
@@ -150,9 +151,14 @@ public class ImportPoints {
 			for (Entry<String, List<EntityPoint>> e : buildingPointList.entrySet()) {
 				for (EntityPoint p : e.getValue()) {
 					try {
-						HBaseUtil.Insert_dy_pointlist(Constant.agent, Constant.BuildingDB.get(p.building), p.building,
-								p.meter, p.funcid, p.system, p.source, p.address_1, p.ip_port, p.address_2, p.address_3,
-								p.address_4, p.collect_cycle, p.data_type, p.unit);
+						// HBaseUtil.Insert_dy_pointlist(Constant.agent,
+						// Constant.BuildingDB.get(p.building), p.building,
+						// p.meter, p.funcid, p.system, p.source, p.address_1,
+						// p.ip_port, p.address_2, p.address_3,
+						// p.address_4, p.collect_cycle, p.data_type, p.unit);
+						Constant.Insert_agents_dy_pointlist(p.building, p.meter, (int) p.funcid, p.system, p.source,
+								p.address_1, p.ip_port, p.address_2, p.address_3, p.address_4, p.collect_cycle,
+								p.data_type, p.unit);
 					} catch (Exception e1) {
 						// TODO Auto-generated catch block
 						e1.printStackTrace();
@@ -167,22 +173,94 @@ public class ImportPoints {
 
 	}
 
-	private static void agentStart() {
+	private static void agentsStart() {
 		// TODO Auto-generated method stub
 		try {
-			String resource = "/hbase-site.xml";
-			Configuration configuration = new Configuration();
+			// String resource = "/hbase-site.xml";
+			// Configuration configuration = new Configuration();
+			// configuration.addResource(new
+			// FileInputStream(System.getProperty("user.dir") + resource));
+			// int zookeeper_sessionTimeout = 300000;
 
-			configuration.addResource(new FileInputStream(System.getProperty("user.dir") + resource));
-			String zookeeper_connectionAddress = "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181";
+			List<String> qrlist = new ArrayList<String>();
+			qrlist.add("zookeeper1:2181,zookeeper2:2181,zookeeper3:2181");
+			qrlist.add("zookeeper1,zookeeper2,zookeeper3");
+			qrlist.add("zookeeper1");
+			qrlist.add("zookeeper1.saga");
 
-			int zookeeper_sessionTimeout = 300000;
-			Constant.agent = new ZillionAgent(configuration, zookeeper_connectionAddress, zookeeper_sessionTimeout);
-			Constant.agent.Start();
+			for (String qr : qrlist) {
+				try {
+					Configuration configuration = new Configuration();
+					configuration.set("hbase.cluster.distributed", "true");
+					configuration.set("hbase.zookeeper.quorum", qr);
+					ZillionAgent agent = new ZillionAgent(configuration);
+					agent.setFull_name(qr);
+					agent.Start();
+					Constant.agents.add(agent);
+				} catch (Exception e) {
+					e.printStackTrace();
+					LogUtil.error("Main.init.agentsStart: " + e.toString());
+				}
+			}
+			// Constant.agents.add(new ZillionAgent(configuration,
+			// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
+			// zookeeper_sessionTimeout));
+			// Constant.agents
+			// .add(new ZillionAgent(configuration,
+			// "zookeeper1,zookeeper2,zookeeper3", zookeeper_sessionTimeout));
+			// Constant.agents.add(new ZillionAgent(configuration, "zookeeper1",
+			// zookeeper_sessionTimeout));
+			// Constant.agents.add(new ZillionAgent(configuration,
+			// "zookeeper1.saga", zookeeper_sessionTimeout));
 
+			// Iterator<ZillionAgent> it = Constant.agents.iterator();
+			// while (it.hasNext()) {
+			// ZillionAgent agent = it.next();
+			// try {
+			// agent.Start();
+			// LogUtil.info(agent.getFull_name() + " starting ...");
+			// } catch (Exception e) {
+			// // TODO Auto-generated catch block
+			// // agent启动失败则移除,以免造成资源浪费
+			// LogUtil.warn(agent.getFull_name() + " failed to start ,now remove
+			// !");
+			// it.remove();
+			// LogUtil.error("Main.init.agentsStart: " + e.toString());
+			// }
+			// }
 		} catch (Exception e) {
 			// TODO Auto-generated catch block
-			e.printStackTrace();
+			LogUtil.error("Main.init.agentsStart: " + e.toString());
 		}
 	}
+
+	// private static void agentStart() {
+	// // TODO Auto-generated method stub
+	// try {
+	// String resource = "/hbase-site.xml";
+	// Configuration configuration = new Configuration();
+	// configuration.addResource(new
+	// FileInputStream(System.getProperty("user.dir") + resource));
+	// int zookeeper_sessionTimeout = 300000;
+	//
+	// Constant.agents.add(new ZillionAgent(configuration,
+	// "zookeeper1:2181,zookeeper2:2181,zookeeper3:2181",
+	// zookeeper_sessionTimeout));
+	// Constant.agents
+	// .add(new ZillionAgent(configuration, "zookeeper1,zookeeper2,zookeeper3",
+	// zookeeper_sessionTimeout));
+	// for (ZillionAgent agent : Constant.agents) {
+	// try {
+	// agent.Start();
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// LogUtil.error("Main.init.agentsStart: " + e.toString());
+	// }
+	// }
+	//
+	// } catch (Exception e) {
+	// // TODO Auto-generated catch block
+	// e.printStackTrace();
+	// }
+	// }
 }

+ 251 - 2
collect/src/main/java/com/saga/util/Constant.java

@@ -11,7 +11,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -32,7 +31,8 @@ import com.zillion.database.agent.ZillionAgent;
 public class Constant {
 	public static int PacketId = 0;
 	public static int InsertThread = 1;
-	public static ZillionAgent agent;
+	// public static ZillionAgent agent;
+	public static List<ZillionAgent> agents = new ArrayList<ZillionAgent>();
 	public static boolean DBConn = true;
 	public static String WaitingTimeControl = "5Second";
 	public static File setlog = new File(System.getProperty("user.dir") + "/setlog.log");
@@ -320,6 +320,150 @@ public class Constant {
 
 	}
 
+	public static void Insert_agents_ps_physical_log(String project, String address_1, String address_2,
+			String address_3, String address_4, String receivetime, String status) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_physical_log(agent, Constant.BuildingDB.get(project), project, address_1, address_2,
+						address_3, address_4, receivetime, status);
+				LogUtil.info(agent.getFull_name() + " insert into ps_physical_log " + " project " + project
+						+ " address_1 " + address_1 + " address_2 " + address_2 + " address_3 " + address_3
+						+ " address_4 " + address_4 + " receivetime " + receivetime + " status " + status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_physical_status(String project, String address_1, String address_2,
+			String address_3, String address_4, String status, String receivetime, String detail) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_physical_status(agent, Constant.BuildingDB.get(project), project, address_1,
+						address_2, address_3, address_4, status, receivetime, detail);
+				LogUtil.info(agent.getFull_name() + " insert into ps_physical_status " + " project " + project
+						+ " address_1 " + address_1 + " address_2 " + address_2 + " address_3 " + address_3
+						+ " address_4 " + address_4 + " receivetime " + receivetime + " status " + status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_meter_log(String project, String meter, String updown,
+			String receivetime, String status) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_virtual_meter_log(agent, Constant.BuildingDB.get(project), project, meter, updown,
+						receivetime, status);
+				LogUtil.info(
+						agent.getFull_name() + " insert into ps_virtual_meter_log " + " project " + project + " meter "
+								+ meter + " updown " + updown + " receivetime " + receivetime + " status " + status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_meter_status(String project, String meter, String updown, String status,
+			String receivetime, String detail) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_virtual_meter_status(agent, Constant.BuildingDB.get(project), project, meter,
+						updown, status, receivetime, detail);
+				LogUtil.info(agent.getFull_name() + " insert into ps_virtual_meter_status " + " project " + project
+						+ " meter " + meter + " updown " + updown + " receivetime " + receivetime + " status "
+						+ status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_point_log(String building, String meter, Long funcid, String updown,
+			Long time, Long seq, String status, String feedback) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				if (time == null || time == 0) {
+					HBaseUtil.Insert_ps_virtual_point_log(agent, Constant.BuildingDB.get(building), building, meter,
+							Long.valueOf(funcid), updown, Constant.format(new Date()), seq, status, feedback);
+				} else {
+					HBaseUtil.Insert_ps_virtual_point_log(agent, Constant.BuildingDB.get(building), building, meter,
+							Long.valueOf(funcid), updown, Constant.format(new Date(time)), seq, status, feedback);
+				}
+				LogUtil.info(agent.getFull_name() + " insert into ps_virtual_point_log " + " building " + building
+						+ " meter " + meter + " updown " + updown + " funcid " + funcid + " status " + status
+						+ " feedback " + feedback);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_point_status(String building, String meter, Long funcid, String updown,
+			String status, Long time, String detail) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				if (time == null || time == 0) {
+					HBaseUtil.Insert_ps_virtual_point_status(agent, Constant.BuildingDB.get(building), building, meter,
+							Long.valueOf(funcid), "up", status, Constant.format(new Date()), "");
+
+				} else {
+					HBaseUtil.Insert_ps_virtual_point_status(agent, Constant.BuildingDB.get(building), building, meter,
+							Long.valueOf(funcid), "up", status, Constant.format(new Date(time)), "");
+				}
+				LogUtil.info(agent.getFull_name() + " insert into ps_virtual_point_status " + " building " + building
+						+ " meter " + meter + " updown " + updown + " funcid " + funcid + " status " + status
+						+ " detail " + detail);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_project_log(String project, String receivetime, String status) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_virtual_project_log(agent, Constant.BuildingDB.get(project), project, receivetime,
+						status);
+				LogUtil.info(agent.getFull_name() + " insert into ps_virtual_project_log " + " project " + project
+						+ " receivetime " + receivetime + " status " + status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void Insert_agents_ps_virtual_project_status(String project, String status, String receivetime,
+			String detail) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_ps_virtual_project_status(agent, Constant.BuildingDB.get(project), project, status,
+						receivetime, detail);
+				LogUtil.info(agent.getFull_name() + " insert into ps_virtual_project_status " + " project " + project
+						+ " receivetime " + receivetime + " status " + status);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
 	public static List<String> getConfigFile(String directoryPath, String directoryKey, String fileKey) {
 		List<String> list = new ArrayList<String>();
 		File baseFile = new File(directoryPath);
@@ -412,4 +556,109 @@ public class Constant {
 		public static final long DAY = 1000L * 60 * 60 * 24;
 
 	}
+
+	public static void Insert_agents_dy_pointlist(String building, String meter, Integer funcid, String system,
+			String source, String address1, String ip_port, String address2, String address3, String address4,
+			String collect_cycle, String data_type, String unit) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.Insert_dy_pointlist(agent, Constant.BuildingDB.get(building), building, meter, funcid, system,
+						source, address1, ip_port, address2, "", "", collect_cycle, data_type, unit);
+				LogUtil.info(agent.getFull_name() + " insert into dy_pointlist " + " building " + building + " meter "
+						+ meter + " funcid " + funcid);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void AgentsBatchInsert(String db, List<Record> wtdbrecordList) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.BatchInsert(agent, db, wtdbrecordList);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void AgentsBatchInsert_Set2(String db, PointSet ps) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.BatchInsert_Set2(agent, db, ps);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void AgentsBatchInsert_Set3(String db, PointSet ps) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.BatchInsert_Set3(agent, db, ps);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static void AgentsBatchInsert_Set1(String db, PointSet ps) {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				HBaseUtil.BatchInsert_Set1(agent, db, ps);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+
+	public static Map<String, List<Integer>> AgentsGetDBPointList(String db, String tb, String building) {
+		// TODO Auto-generated method stub
+		Map<String, List<Integer>> dbPointList = new HashMap<String, List<Integer>>();
+		for (ZillionAgent agent : Constant.agents) {
+			try {
+				Map<String, List<Integer>> pl = HBaseUtil.GetDBPointList(agent, db, tb, building);
+				for (Entry<String, List<Integer>> m : pl.entrySet()) {
+					if (!dbPointList.containsKey(m.getKey())) {
+						dbPointList.put(m.getKey(), new ArrayList<Integer>());
+					}
+					for (Integer f : m.getValue()) {
+						if (!dbPointList.get(m.getKey()).contains(f)) {
+							dbPointList.get(m.getKey()).add(f);
+						}
+					}
+				}
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+		return dbPointList;
+	}
+
+	public static void AgentsLoadDB2Cache_dy_pointlist() {
+		// TODO Auto-generated method stub
+		for (ZillionAgent agent : Constant.agents) {
+			for (Entry<String, String> bd : Constant.BuildingDB.entrySet()) {
+				try {
+					String project = bd.getKey();
+					String db = bd.getValue();
+					HBaseUtil.LoadDB2Cache_dy_pointlist(agent, db, "dy_pointlist", project);
+				} catch (Exception e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+	}
 }

+ 56 - 54
collect/src/main/java/com/saga/util/HBaseUtil.java

@@ -41,7 +41,7 @@ public class HBaseUtil {
 		wrapperObject.put("Datatable", tb);
 		wrapperObject.put("Criteria", Criteria);
 
-		LogUtil.info("Reload Project Point List:" + project + "  dy_pointlist Begin...");
+		LogUtil.info(agent.getFull_name() + " Reload Project Point List:" + project + "  dy_pointlist Begin...");
 		JSONObject queryResult = agent.Query(wrapperObject);
 		JSONArray resultContent = (JSONArray) queryResult.get("Content");
 		for (int i = 0; i < resultContent.size(); i++) {
@@ -105,7 +105,7 @@ public class HBaseUtil {
 
 			checkStatus(project, meter, funcid, address_1, address_2, address_3, address_4);
 		}
-		LogUtil.info("Reload Project Point List:" + project + "  dy_pointlist End...");
+		LogUtil.info(agent.getFull_name() + " Reload Project Point List:" + project + "  dy_pointlist End...");
 
 	}
 
@@ -158,7 +158,7 @@ public class HBaseUtil {
 		wrapperObject.put("Database", db);
 		wrapperObject.put("Datatable", tb);
 		wrapperObject.put("Criteria", Criteria);
-		LogUtil.info("Reload Project:" + project + "  ps_physical_status Begin...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + "  ps_physical_status Begin...");
 		JSONObject queryResult = agent.Query(wrapperObject);
 		JSONArray resultContent = (JSONArray) queryResult.get("Content");
 		for (int i = 0; i < resultContent.size(); i++) {
@@ -172,7 +172,7 @@ public class HBaseUtil {
 			Constant.ps_PhysicalStatus.put(key, Constant.parse(receivetime).getTime());
 
 		}
-		LogUtil.info("Reload Project:" + project + "  ps_physical_status End...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + "  ps_physical_status End...");
 
 	}
 
@@ -196,7 +196,7 @@ public class HBaseUtil {
 		wrapperObject.put("Criteria", Criteria);
 		JSONObject queryResult = agent.Query(wrapperObject);
 		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-		LogUtil.info("Reload Project:" + project + " ps_virtual_point_status Begin...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + " ps_virtual_point_status Begin...");
 
 		for (int i = 0; i < resultContent.size(); i++) {
 			JSONObject dataItem = (JSONObject) resultContent.get(i);
@@ -207,12 +207,12 @@ public class HBaseUtil {
 				String key = project + "-" + meter + "." + funcid;
 				String receivetime = (String) dataItem.get("receivetime");
 				Constant.ps_PointStatusUp.put(key, Constant.parse(receivetime).getTime());
-				LogUtil.info("project " + project + " meter " + meter + " funcid " + funcid + " "
-						+ System.currentTimeMillis() + " " + Constant.parse(receivetime).getTime());
+				LogUtil.info(agent.getFull_name() + " project " + project + " meter " + meter + " funcid " + funcid
+						+ " " + System.currentTimeMillis() + " " + Constant.parse(receivetime).getTime());
 			}
 		}
 		// }
-		LogUtil.info("Reload Project:" + project + "  ps_virtual_point_status End...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + "  ps_virtual_point_status End...");
 	}
 
 	public static void LoadDB2Cache_ps_virtual_meter_status(ZillionAgent agent, String db, String tb, String project)
@@ -234,7 +234,7 @@ public class HBaseUtil {
 		wrapperObject.put("Criteria", Criteria);
 		JSONObject queryResult = agent.Query(wrapperObject);
 		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-		LogUtil.info("Reload Project:" + project + " ps_virtual_meter_status Begin...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + " ps_virtual_meter_status Begin...");
 
 		for (int i = 0; i < resultContent.size(); i++) {
 			JSONObject dataItem = (JSONObject) resultContent.get(i);
@@ -244,11 +244,11 @@ public class HBaseUtil {
 				String key = project + "-" + meter;
 				String receivetime = (String) dataItem.get("receivetime");
 				Constant.ps_MeterStatusUp.put(key, Constant.parse(receivetime).getTime());
-				LogUtil.info("project " + project + " meter " + meter + " " + System.currentTimeMillis() + " "
-						+ Constant.parse(receivetime).getTime());
+				LogUtil.info(agent.getFull_name() + " project " + project + " meter " + meter + " "
+						+ System.currentTimeMillis() + " " + Constant.parse(receivetime).getTime());
 			}
 		}
-		LogUtil.info("Reload Project:" + project + "  ps_virtual_meter_status End...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + "  ps_virtual_meter_status End...");
 	}
 
 	public static void LoadDB2Cache_ps_virtual_project_status(ZillionAgent agent, String db, String tb, String project)
@@ -268,7 +268,7 @@ public class HBaseUtil {
 		wrapperObject.put("Criteria", Criteria);
 		JSONObject queryResult = agent.Query(wrapperObject);
 		JSONArray resultContent = (JSONArray) queryResult.get("Content");
-		LogUtil.info("Reload Project:" + project + " ps_virtual_project_status Begin...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + " ps_virtual_project_status Begin...");
 
 		for (int i = 0; i < resultContent.size(); i++) {
 			JSONObject dataItem = (JSONObject) resultContent.get(i);
@@ -276,11 +276,11 @@ public class HBaseUtil {
 			String key = project;
 			String receivetime = (String) dataItem.get("receivetime");
 			Constant.ps_ProjectStatus.put(key, Constant.parse(receivetime).getTime());
-			LogUtil.info("project " + project + " " + System.currentTimeMillis() + " "
+			LogUtil.info(agent.getFull_name() + " project " + project + " " + System.currentTimeMillis() + " "
 					+ Constant.parse(receivetime).getTime());
 
 		}
-		LogUtil.info("Reload Project:" + project + "  ps_virtual_project_status End...");
+		LogUtil.info(agent.getFull_name() + " Reload Project:" + project + "  ps_virtual_project_status End...");
 	}
 
 	// public static void GetCollectorStatus(ZillionAgent agent, String db,
@@ -529,6 +529,7 @@ public class HBaseUtil {
 	}
 
 	public static void CreateDB(ZillionAgent agent, String DB) throws Exception {
+		LogUtil.info(agent.getFull_name() + " CreateDB:" + DB);
 		agent.NDL_AddDatabase(DB);
 	}
 
@@ -536,6 +537,7 @@ public class HBaseUtil {
 		JSONObject wrapperObject = new JSONObject();
 		wrapperObject.put("QueryType", "table_list");
 		wrapperObject.put("Database", DBName);
+		LogUtil.info(agent.getFull_name() + " " + DBName + "." + tableName + " tableExist ?");
 		JSONObject result = agent.Query(wrapperObject);
 		JSONArray array = (JSONArray) result.get("Content");
 		for (int i = 0; i < array.size(); i++) {
@@ -1174,7 +1176,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.InsertCollectorStatus.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.InsertCollectorStatus.Exception: " + e.toString());
 		}
 	}
 
@@ -1208,7 +1210,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.BatchInsert.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert.Exception: " + e.toString());
 		}
 	}
 
@@ -1247,7 +1249,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.InsertPointStatus.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.InsertPointStatus.Exception: " + e.toString());
 		}
 	}
 
@@ -1272,7 +1274,7 @@ public class HBaseUtil {
 			wrapperObject.put("Database", DB);
 			wrapperObject.put("Datatable", "dy_pointlist");
 			wrapperObject.put("InsertObjects", InsertObjects);
-			LogUtil.info("InsertDBPointList" + wrapperObject);
+			LogUtil.info(agent.getFull_name() + " InsertDBPointList" + wrapperObject);
 			agent.Query(wrapperObject);
 		}
 	}
@@ -1308,7 +1310,7 @@ public class HBaseUtil {
 
 		} catch (Exception e) {
 			e.printStackTrace();
-			LogUtil.error("HBaseUtil.InsertPointInfo.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.InsertPointInfo.Exception: " + e.toString());
 		}
 	}
 
@@ -1348,7 +1350,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.InsertPointCommunicationLog.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.InsertPointCommunicationLog.Exception: " + e.toString());
 		}
 	}
 
@@ -1384,7 +1386,8 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_fjd_0_buildingcomputetime.Exception: " + e.toString());
+			LogUtil.error(
+					agent.getFull_name() + " HBaseUtil.Insert_fjd_0_buildingcomputetime.Exception: " + e.toString());
 		}
 	}
 
@@ -1448,7 +1451,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_dy_pointlist.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_dy_pointlist.Exception: " + e.toString());
 		}
 	}
 
@@ -1508,7 +1511,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_physical_status.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_ps_physical_status.Exception: " + e.toString());
 		}
 	}
 
@@ -1556,7 +1559,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_physical_log.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_ps_physical_log.Exception: " + e.toString());
 		}
 	}
 
@@ -1602,7 +1605,8 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_point_status.Exception: " + e.toString());
+			LogUtil.error(
+					agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_point_status.Exception: " + e.toString());
 		}
 	}
 
@@ -1652,11 +1656,11 @@ public class HBaseUtil {
 				wrapperObject.put("Datatable", "ps_virtual_point_log");
 				wrapperObject.put("InsertObjects", InsertObjects);
 				agent.Query(wrapperObject);
-				LogUtil.info(wrapperObject.toJSONString());
+				LogUtil.info(agent.getFull_name() + " " + wrapperObject.toJSONString());
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_point_log.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_point_log.Exception: " + e.toString());
 		}
 	}
 
@@ -1700,7 +1704,8 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_meter_status.Exception: " + e.toString());
+			LogUtil.error(
+					agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_meter_status.Exception: " + e.toString());
 		}
 	}
 
@@ -1740,7 +1745,7 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_meter_log.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_meter_log.Exception: " + e.toString());
 		}
 	}
 
@@ -1780,7 +1785,8 @@ public class HBaseUtil {
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_project_status.Exception: " + e.toString());
+			LogUtil.error(
+					agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_project_status.Exception: " + e.toString());
 		}
 	}
 
@@ -1813,11 +1819,11 @@ public class HBaseUtil {
 				wrapperObject.put("Datatable", "ps_virtual_project_log");
 				wrapperObject.put("InsertObjects", InsertObjects);
 				agent.Query(wrapperObject);
-				LogUtil.info(wrapperObject.toJSONString());
+				LogUtil.info(agent.getFull_name() + " " + wrapperObject.toJSONString());
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.Insert_ps_virtual_project_log.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.Insert_ps_virtual_project_log.Exception: " + e.toString());
 		}
 	}
 	// public static void InsertPointCommunicationLog(List<String> list) throws
@@ -1917,17 +1923,16 @@ public class HBaseUtil {
 						wrapperObject.put("Datatable", "original_present");
 						wrapperObject.put("InsertObjects", InsertObjects);
 						agent.Query(wrapperObject);
-						// LogUtil.info("insert into " + DB + "." +
-						// "original_month&" + "original_present "
-						// + InsertObjects.toFormatString());
+						LogUtil.info(agent.getFull_name() + " insert into " + DB + "." + "original_month&"
+								+ "original_present " + InsertObjects.toFormatString());
 					}
-					LogUtil.info(
-							"insert into " + DB + "." + "original_month&" + "original_present " + InsertObjects.size());
+					LogUtil.info(agent.getFull_name() + " insert into " + DB + "." + "original_month&"
+							+ "original_present " + InsertObjects.size());
 				}
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.BatchInsert.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert.Exception: " + e.toString());
 			Constant.DBConn = false;
 		}
 	}
@@ -1949,7 +1954,7 @@ public class HBaseUtil {
 				InsertObject.put("data", ps.dataSet);
 				InsertObject.put("status", "processing:sent");
 
-				// LogUtil.info(InsertObject.toFormatString());
+				LogUtil.info(agent.getFull_name() + " " + InsertObject.toFormatString());
 
 				InsertObjects.add(InsertObject);
 
@@ -1969,14 +1974,13 @@ public class HBaseUtil {
 					wrapperObject.put("Datatable", "originalset_present");
 					wrapperObject.put("InsertObjects", InsertObjects);
 					agent.Query(wrapperObject);
-					// LogUtil.info("insert into " + DB + "." + "originalset&" +
-					// "originalset_present "
-					// + InsertObject.toFormatString());
+					LogUtil.info(agent.getFull_name() + " insert into " + DB + "." + "originalset&"
+							+ "originalset_present " + InsertObject.toFormatString());
 				}
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.BatchInsert_Set1.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert_Set1.Exception: " + e.toString());
 		}
 	}
 
@@ -1998,7 +2002,7 @@ public class HBaseUtil {
 				InsertObject.put("status", "finish:finish:" + ps.status);
 				InsertObject.put("endtime", Constant.format(new Date()));
 
-				// LogUtil.info(InsertObject.toFormatString());
+				LogUtil.info(agent.getFull_name() + " " + InsertObject.toFormatString());
 
 				InsertObjects.add(InsertObject);
 
@@ -2018,14 +2022,13 @@ public class HBaseUtil {
 					wrapperObject.put("Datatable", "originalset_present");
 					wrapperObject.put("InsertObjects", InsertObjects);
 					agent.Query(wrapperObject);
-					// LogUtil.info("insert into " + DB + "." + "originalset&" +
-					// "originalset_present "
-					// + InsertObject.toFormatString());
+					LogUtil.info(agent.getFull_name() + " insert into " + DB + "." + "originalset&"
+							+ "originalset_present " + InsertObject.toFormatString());
 				}
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.BatchInsert_Set2.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert_Set2.Exception: " + e.toString());
 		}
 	}
 
@@ -2047,7 +2050,7 @@ public class HBaseUtil {
 				InsertObject.put("status", "finish:finish:" + "fail:timeout");
 				InsertObject.put("endtime", Constant.format(new Date()));
 
-				// LogUtil.info(InsertObject.toFormatString());
+				LogUtil.info(agent.getFull_name() + " " + InsertObject.toFormatString());
 
 				InsertObjects.add(InsertObject);
 
@@ -2066,14 +2069,13 @@ public class HBaseUtil {
 					wrapperObject.put("Datatable", "originalset_present");
 					wrapperObject.put("InsertObjects", InsertObjects);
 					agent.Query(wrapperObject);
-					// LogUtil.info("insert into " + DB + "." + "originalset&" +
-					// "originalset_present "
-					// + InsertObject.toFormatString());
+					LogUtil.info(agent.getFull_name() + " insert into " + DB + "." + "originalset&"
+							+ "originalset_present " + InsertObject.toFormatString());
 				}
 			}
 
 		} catch (Exception e) {
-			LogUtil.error("HBaseUtil.BatchInsert_Set3.Exception: " + e.toString());
+			LogUtil.error(agent.getFull_name() + " HBaseUtil.BatchInsert_Set3.Exception: " + e.toString());
 		}
 	}
 

BIN
collect/zillion-util-1.8.2.jar