| | |
| | | package main;
|
| | | import java.sql.Connection;
|
| | | import java.sql.SQLException;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.base.Com;
|
| | | import com.config.AppConfig;
|
| | | import com.config.AppParam;
|
| | | import com.sql.MysqlConnPool;
|
| | |
|
| | | public class main_WaterSystem_MonitorServer {
|
| | | /**************************************************************************/
|
| | | /**************************************************************************/
|
| | | /**************************************************************************/
|
| | | /**************************************************************************/
|
| | | /**************************************************************************/
|
| | | public final static boolean app_debug = false;
|
| | | |
| | | public final static double m_VersionNum = 1.102;
|
| | | public final static String m_Version = "Welcome To Use main_MonitorServer_Motor V" |
| | | + m_VersionNum ;
|
| | | /**************************************************************************/
|
| | | |
| | | |
| | | /**************************************************************************/
|
| | | public static final int MysqlServer_Port = 3360;
|
| | | |
| | | private static AppConfig m_AppConfig;
|
| | | |
| | | private static MysqlConnPool GB_MysqlConnPool;
|
| | | public static AppParam GB_App_Param;
|
| | | |
| | | |
| | | /*********************************************************************************************/
|
| | | /*********************************************************************************************/
|
| | | public static void main(String[] args) {
|
| | | String ver = m_Version;
|
| | | |
| | | System.out.println("main_MonitorServer_Motor Server Started At DateTime: " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
| | | //创建config.xml文件
|
| | | m_AppConfig = new AppConfig();
|
| | | |
| | | System.out.println("SQLserver IP:" + m_AppConfig.getMysqlServerIp() + ", port: "+MysqlServer_Port);
|
| | | //初始化连接池中的各种参数信息
|
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, |
| | | 100);
|
| | | |
| | | //创建tb_app_param表,并且设置表中的数据
|
| | | GB_App_Param = new AppParam(GB_MysqlConnPool);
|
| | | |
| | | checkingMySQLServerStart(); //检测数据库服务是否启动
|
| | | /*********************************************************************************/
|
| | | /*********************************************************************************/
|
| | | |
| | | |
| | | |
| | | while(true) {
|
| | | try { |
| | | Thread.sleep(5000);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | /*********************************************************************************/
|
| | | }
|
| | | |
| | | public static void checkingMySQLServerStart(){
|
| | | int MysqlServer_Port = 3360;
|
| | | System.out.println("IP:"+m_AppConfig.getMysqlServerIp()+"port"+MysqlServer_Port); |
| | | //初始化连接池中的各种参数信息 m_AppConfig.getMysqlServerIp()
|
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 5);
|
| | | while(true){
|
| | | Connection conn = null;
|
| | | try {
|
| | | System.out.println(" 开始检测数据库连接 "+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
| | | conn = GB_MysqlConnPool.getConn();
|
| | | if(conn != null){
|
| | | System.out.println("检测数据库连接成功");
|
| | | break;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | } catch (InterruptedException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | System.out.println(" MySQL_FBSDEV not Start ... ");
|
| | | } finally {
|
| | | if(conn != null) {
|
| | | try {
|
| | | conn.close();
|
| | | } catch (SQLException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | package main; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.base.Com; |
| | | import com.config.AppConfig; |
| | | import com.config.AppParam; |
| | | import com.sql.MysqlConnPool; |
| | | import com.sql.Sql_Mysql; |
| | | import com.watersystem.monitor.WaterSystem_RealDataRecord_Thread; |
| | | import com.watersystem.monitor.Water_Task_SQL; |
| | | import com.watersystem.monitor.Water_inf; |
| | | import com.watersystem.monitor.Watersystem_ServerSocket_Thread; |
| | | |
| | | public class main_WaterSystem_MonitorServer { |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |
| | | /**************************************************************************/ |
| | | public final static boolean app_debug = false; |
| | | public final static double m_VersionNum = 1.302; |
| | | public final static String m_Version = "Welcome To Use main_MonitorServer_Motor V" |
| | | + m_VersionNum ; |
| | | /**************************************************************************/ |
| | | |
| | | |
| | | /**************************************************************************/ |
| | | public static final int MysqlServer_Port = 3360; |
| | | |
| | | private static AppConfig m_AppConfig; |
| | | |
| | | private static MysqlConnPool GB_MysqlConnPool; |
| | | public static AppParam GB_App_Param; |
| | | |
| | | public static List<Water_inf> winfs=new ArrayList(); |
| | | |
| | | |
| | | /*********************************************************************************************/ |
| | | /*********************************************************************************************/ |
| | | public static void main(String[] args) { |
| | | String ver = m_Version; |
| | | |
| | | System.out.println("main_MonitorServer_Motor Server Started At DateTime: " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | //创建config.xml文件 |
| | | m_AppConfig = new AppConfig(); |
| | | |
| | | System.out.println("SQLserver IP:" + m_AppConfig.getMysqlServerIp() + ", port: "+MysqlServer_Port); |
| | | //初始化连接池中的各种参数信息 |
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, |
| | | 100); |
| | | |
| | | //创建tb_app_param表,并且设置表中的数据 |
| | | GB_App_Param = new AppParam(GB_MysqlConnPool); |
| | | |
| | | checkingMySQLServerStart(); //检测数据库服务是否启动 |
| | | /*********************************************************************************/ |
| | | /*********************************************************************************/ |
| | | //初始化数据库 |
| | | Water_Task_SQL.init(GB_MysqlConnPool); |
| | | |
| | | //获取所有的水冷系统 |
| | | Water_Task_SQL.queryAllWater(GB_MysqlConnPool, winfs); |
| | | //System.out.println(winfs); |
| | | //读取每套水冷系统的信息 |
| | | Watersystem_ServerSocket_Thread server = new Watersystem_ServerSocket_Thread(GB_MysqlConnPool,winfs); |
| | | new Thread(server).start(); |
| | | |
| | | |
| | | /****************************** 记录历史实时数据 ************************************/ |
| | | { |
| | | WaterSystem_RealDataRecord_Thread record_thread = new WaterSystem_RealDataRecord_Thread(GB_MysqlConnPool, winfs); |
| | | new Thread(record_thread).start(); |
| | | } |
| | | |
| | | |
| | | while(true) { |
| | | try { |
| | | Thread.sleep(5000); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | /*********************************************************************************/ |
| | | } |
| | | |
| | | public static void checkingMySQLServerStart(){ |
| | | int MysqlServer_Port = 3360; |
| | | System.out.println("IP:"+m_AppConfig.getMysqlServerIp()+"port"+MysqlServer_Port); |
| | | //初始化连接池中的各种参数信息 m_AppConfig.getMysqlServerIp() |
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 5); |
| | | while(true){ |
| | | Connection conn = null; |
| | | try { |
| | | System.out.println(" 开始检测数据库连接 "+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | conn = GB_MysqlConnPool.getConn(); |
| | | if(conn != null){ |
| | | System.out.println("检测数据库连接成功"); |
| | | break; |
| | | } |
| | | } catch (Exception e) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | System.out.println(" MySQL_FBSDEV not Start ... "); |
| | | } finally { |
| | | if(conn != null) { |
| | | try { |
| | | conn.close(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |