From 3bde0e9ee5b1e584c29e516fdfc9a99376d228d3 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq,com> Date: 星期三, 19 八月 2020 16:48:53 +0800 Subject: [PATCH] 水冷提交 --- WaterSystem_MonitorServer/src/main/main_WaterSystem_MonitorServer.java | 210 ++++++++++++++++++++++++++++------------------------ 1 files changed, 112 insertions(+), 98 deletions(-) diff --git a/WaterSystem_MonitorServer/src/main/main_WaterSystem_MonitorServer.java b/WaterSystem_MonitorServer/src/main/main_WaterSystem_MonitorServer.java index 7456eb5..dce167f 100644 --- a/WaterSystem_MonitorServer/src/main/main_WaterSystem_MonitorServer.java +++ b/WaterSystem_MonitorServer/src/main/main_WaterSystem_MonitorServer.java @@ -1,98 +1,112 @@ -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.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.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 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); + + //读取每套水冷系统的信息 + Watersystem_ServerSocket_Thread server = new Watersystem_ServerSocket_Thread(GB_MysqlConnPool,winfs); + new Thread(server).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(); + } + } + } + } + } +} -- Gitblit v1.9.1