📄 main.java~34~
字号:
package smstimer;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class Main extends Engine{ public getIniString ini = new getIniString(); public Main() { super("Main"); setDaemon(true); } public boolean ReadIni(){ try{ System.out.println("-------短信定制平台-------SMSTimer1.0-------"); System.out.println("请不要用鼠标点击command窗口。如果点击了,请回车!"); Config.order_text = ini.getString("[LOCAL]","order_text") ; System.out.println(" 点播命令 : "+ Config.order_text ); Config.cancel_text = ini.getString("[LOCAL]","cancel_text") ; System.out.println(" 退订命令 : "+ Config.cancel_text ); Config.odbcstring = ini.getString("[LOCAL]","odbcstring") ; System.out.println(" 数据库连接驱动 : "+ Config.odbcstring ); Config.db_host=ini.getString("[LOCAL]","db_host"); System.out.println(" 数据库IP地址 : "+Config.db_host); Config.db_name=ini.getString("[LOCAL]","db_name"); System.out.println(" 数据库名称 : "+Config.db_name); Config.db_user=ini.getString("[LOCAL]","db_user"); System.out.println(" 数据库用户名 : "+Config.db_user); Config.db_password=ini.getString("[LOCAL]","db_password"); System.out.println(" 数据库密码 : "+Config.db_password ); Config.free_service_code = ini.getString("[LOCAL]","free_service_code"); System.out.println(" 预报定制的免费服务代码 : "+Config.free_service_code ); Config.sp_id = ini.getString("[LOCAL]","sp_id"); System.out.println(" 预报定制的下发特服号 : "+Config.sp_id ); return true; }catch(Exception e){ return false; } } public void run(){ ReadIni(); try{ System.out.println("Wait 2 second..."); sleep(1000*2); }catch(Exception e){ } Config.ConnectDb() ; GetUser getUser = new GetUser(Config.db); SendManager sendManager = new SendManager(Config.db); GetServiceIdList getServiceIdList = new GetServiceIdList(Config.db); SendThread sendThread = new SendThread(); CancelUser cancelUser = new CancelUser(); try{ System.out.println("Wait 2 second..."); sleep(1000*2); }catch(Exception e){ } getServiceIdList.startup() ; getUser.startup(); sendManager.startup() ; sendThread.startup() ; cancelUser.startup() ; while(true){ if(!getUser.isAlive() ||!getUser.isRunning() ){ try{ getUser.shutdown() ; getUser.interrupt() ; sleep(1000*2); getUser.startup(); }catch(Exception e){ System.out.println("Exception In Main.run() :"+e.toString()); } } if(!sendManager.isAlive() ||!sendManager.isRunning() ){ try{ sendManager.shutdown() ; sendManager.interrupt() ; sleep(1000*2); sendManager.startup(); }catch(Exception e){ System.out.println("Exception In Main.run() :"+e.toString()); } } if(!sendThread.isAlive() ||!sendThread.isRunning() ){ try{ sendThread.shutdown() ; sendThread.interrupt() ; sleep(1000*2); sendThread.startup(); }catch(Exception e){ System.out.println("Exception In Main.run() :"+e.toString()); } } if(!cancelUser.isAlive() ||!cancelUser.isRunning() ){ try{ cancelUser.shutdown() ; cancelUser.interrupt() ; sleep(1000*2); cancelUser.startup(); }catch(Exception e){ System.out.println("Exception In Main.run() :"+e.toString()); } } try{ sleep(1000*5); }catch(Exception e){ e.printStackTrace() ; } } } public static void main(String[] args) { Main main1 = new Main(); main1.startup() ; while(true){ try{ Thread.sleep(1000); }catch(Exception e){} } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -