Пример #1
0
 private static void exit()
 {
     running = false;
     GatewayCDR _tmp = gateway;
     GatewayCDR.closeAllConnectionInPool();
     System.out.println("Stop.");
     System.exit(0);
 }
Пример #2
0
 public void run() {
   int numOfCdrs = 0;
   // System.out.println("Getting data from queue table");
   Logger.info("CDRServer:", "Getting data from queue table");
   while (CDRServer.running) {
     try {
       this.readCDRinQueueEx();
       if ("VMS".equals(Preference.mobileOperator.toUpperCase())) {
         // CdrFileCopier4vms cdrcopy = new CdrFileCopier4vms();
         // System.out.println("Starting FTP");
         Logger.info("FTP:", " starting FTP cdr file");
         Ftp2CdrServer ftp = new Ftp2CdrServer(); // .start();
         ftp.runftp();
       } else {
         // System.out.println("Invalid mobile operator: " +
         // Preference.mobileOperator);
         Logger.info("Invalid mobile operator:", Preference.mobileOperator);
         exit();
       }
       sleep10Minutes();
     } catch (InterruptedException ex) {
     } catch (DBException ex) { // when lost connection to db
       // System.out.println("DBScanner::" + ex.getMessage());
       Logger.info("DBScanner:", ex.getMessage());
       try {
         dbTools.log_alert(
             "Billing system",
             "-> ERROR: Ket noi Database bi loi: " + ex.getMessage(),
             1,
             0,
             "serious",
             Preference.alert_person);
       } catch (Exception e) {
       }
       GatewayCDR.rebuildDBConnections(1); // 1 connection
     } catch (Exception ex) {
       // System.out.println("DBScanner::" + ex.getMessage());
       Logger.info("DBScanner:", ex.getMessage());
       try {
         // dbTools.log_alert(Preference.sourceAddressList.toString(),
         // "CDR->DBSCanner",
         // "<-" + Preference.mobileOperator + "-> ERROR: " +
         // ex.getMessage(),
         // 1, Preference.alert_person,
         // Preference.alert_mobile);
         dbTools.log_alert(
             "Billing system",
             "-> ERROR: Loi dinh dang MOBILE OPERATOR: " + ex.getMessage(),
             1,
             0,
             "serious",
             Preference.alert_person);
       } catch (Exception e) {
       }
     }
   }
 }
Пример #3
0
  public static void main(String[] args) {
    try {
      GatewayCDR gateway = new GatewayCDR();
      try {
        Preference.loadProperties("gateway.cfg");
        // if ("GPC".equals(Preference.mobileOperator) ||
        // "VIETTEL".equals(Preference.mobileOperator))
        FtpData.loadProperties("ftp2cdrserver.cfg");
      } catch (Exception e) {
        System.out.println("CDRServer: khong tim thay file cau hinh ");
      }
      gateway.addMoreConnection2Pool(1);

      if (args != null && args.length > 1) {
        System.out.println(">>>" + args[0] + "  >>>  " + args[1]);
        DBScanner.pushCDRinQueueEx8x99(args[0].trim(), args[1].trim());
      } else {
        System.out.println(">>>Thang 04 !!!");
        DBScanner.pushCDRinQueueEx8x99("060401000000", "060425093500");
      }
    } catch (DBException ex) {
      System.out.println(">>>>Loi: " + ex.toString());
    }
  }