?? main.java
字號:
package mmscenter;public class Main extends Engine{ GetNewMmsToPool getNewMmsToPool =null; SendThread sendThread =null; ResendThread resendThread =null; WriteLog writeLog = null; getIniString ini =null; public Main() { super("Main"); setDaemon(true); } public boolean ReadIni(){ try{ System.out.println("-------彩信發(fā)送平臺-------MMSCenter1.0-------"); System.out.println("請不要用鼠標點擊command窗口。如果點擊了,請回車!"); Config.odbcstring = ini.getString("[LOCALDB]","odbcstring") ; System.out.println(" 數(shù)據(jù)庫連接驅(qū)動 : "+ Config.odbcstring ); Config.db_host=ini.getString("[LOCALDB]","host"); System.out.println(" 數(shù)據(jù)庫IP地址 : "+Config.db_host); Config.db_name=ini.getString("[LOCALDB]","name"); System.out.println(" 數(shù)據(jù)庫名稱 : "+Config.db_name); Config.db_user=ini.getString("[LOCALDB]","user"); System.out.println(" 數(shù)據(jù)庫用戶名 : "+Config.db_user); Config.db_password=ini.getString("[LOCALDB]","password"); System.out.println(" 數(shù)據(jù)庫密碼 : "+Config.db_password ); //萬維的認證 Config.user = ini.getString("[MMSCenter]","username"); System.out.println(" 萬維網(wǎng)關(guān)用戶名 : "+Config.user ); Config.password = ini.getString("[MMSCenter]","password"); System.out.println(" 萬維網(wǎng)關(guān)密碼 : "+Config.password ); Config.protocol = ini.getString("[MMSCenter]","protocal"); System.out.println(" MMS包傳輸協(xié)議 : "+Config.protocol ); Config.ip=ini.getString("[MMSCenter]","ip"); System.out.println(" 萬維網(wǎng)關(guān)IP : "+Config.ip ); Config.port=ini.getString("[MMSCenter]","port"); if(Config.port.length() != 0){ Config.port = ":"+Config.port; } System.out.println(" 萬維網(wǎng)關(guān)開放端口 : "+Config.port ); Config.subfolder=ini.getString("[MMSCenter]","subfolder"); System.out.println(" 萬維網(wǎng)關(guān)接口路徑 : "+Config.subfolder ); return true; }catch(Exception e){ return false; } } public void run(){ ini = new getIniString(); System.out.println(" 讀入配置文件 : "+ReadIni()); getNewMmsToPool = new GetNewMmsToPool(); sendThread = new SendThread(); resendThread = new ResendThread(); writeLog = new WriteLog(); while(true){ System.out.println("-------彩信發(fā)送平臺-------MMSCenter1.0-------");// System.out.println(Utility.getTimeStr());// if((Utility.getTimeStr()).startsWith("0000")){//00dian00fen線程重起//// try{// System.out.println("每天重起線程");// getNewMmsToPool.shutdown() ;// System.out.println("getNewMmsToPool線程關(guān)閉");// getNewMmsToPool.nap() ;// getNewMmsToPool.interrupt() ;// getNewMmsToPool.startup() ;// System.out.println("getNewMmsToPool線程重新啟動");// sendThread.shutdown() ;// System.out.println("sendThread線程關(guān)閉");// sendThread.nap() ;// sendThread.interrupt() ;// sendThread.startup() ;// System.out.println("sendThread線程重新啟動");// resendThread.shutdown();// System.out.println("resendThread線程關(guān)閉");// resendThread.nap() ;// resendThread.interrupt() ;// resendThread.startup() ;// System.out.println("resendThread線程重新啟動");// }catch(Exception e){// e.printStackTrace() ;// };// try{// sleep(TimeConfig.TIME_ONE_MINUTE/2);// }catch(Exception e){// e.printStackTrace() ;// }// } if(!getNewMmsToPool.isRunning() ||!getNewMmsToPool.isAlive() ){ getNewMmsToPool.startup() ; System.out.println(":"+Utility.getTimeString()+":"+"getNewMmsToPool線程啟動"); } if(!sendThread.isRunning() || !sendThread.isAlive() ){ sendThread.startup() ; System.out.println(":"+Utility.getTimeString()+":"+"sendThread線程啟動"); } if(!resendThread.isRunning() || !resendThread.isAlive() ){ resendThread.startup() ; System.out.println(":"+Utility.getTimeString()+":"+"resendThread線程啟動"); } if(!writeLog.isRunning() || !writeLog.isAlive() ){ writeLog.startup() ; System.out.println(":"+Utility.getTimeString()+":"+"WriteLog線程啟動"); } try{ sleep(TimeConfig.TIME_ONE_MINUTE/2); }catch(Exception e){ e.printStackTrace() ; } } } public static void main(String[] args) { Main main1 = new Main(); main1.startup() ; while(true){ try{ sleep(TimeConfig.TIME_ONE_MINUTE); }catch(Exception e){ e.printStackTrace() ; } } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -