/** @param args */
  public static void main(String[] args) {
    logger.info("【VOD网关】开始初始化");
    TCPServer server = new TCPServer();
    try {
      new ClassPathXmlApplicationContext("spring/applicationContext.xml");
    } catch (Exception e) {
      logger.info("【VOD网关】模块加载异常", e);
    }
    logger.info("【VOD网关】各模块加载完毕");

    try {
      server.init(args);
      server.reset(args);
      if (!TCPServer.getConfig().isReportType()) {
        reportType reportThread = new reportType(30);
        reportThread.start();
      }
      int threadTime = TCPServer.getConfig().getThreadTime();
      ControllerThread cThread = new ControllerThread(threadTime);
      cThread.start();
    } catch (Exception e) {
      logger.error("【VOD网关】初始化异常" + e.getMessage());
      System.exit(1);
    }
    logger.info("【VOD网关】初始化完毕,绑定端口:" + TCPServer.config.getPort());
  }
 private void reset(String[] args) throws Exception {
   Map controllerMap = TCPServer.getControllerList();
   if (!controllerMap.isEmpty()) {
     Set controllerSet = controllerMap.keySet();
     Iterator controllerIterator = controllerSet.iterator();
     while (controllerIterator.hasNext()) {
       Controller ctrl = (Controller) controllerMap.get(controllerIterator.next());
       telnet.sendCommand("del " + ctrl.getId());
       TCPServer.getControllerList().remove(ctrl.getSessionId());
     }
   }
 }