Ejemplo n.º 1
0
 private static TLCSpiderScheduler initScheduler(String scheduleName) {
   TLCSpiderScheduler scheduler = (TLCSpiderScheduler) applicationContext.getBean(scheduleName);
   scheduler.init();
   scheduler.loadJobs();
   scheduler.start();
   return scheduler;
 }
Ejemplo n.º 2
0
  public static void main(String[] args) throws InterruptedException {
    TLCSpiderScheduler p2pScheduler = null;
    TLCSpiderScheduler articleScheduler = null;
    TLCSpiderScheduler fundScheduler = null;
    try {
      TLCSpiderLoggerUtil.getLogger().info("加载spring配置文件");
      applicationContext = new ClassPathXmlApplicationContext("classpath*: spring-*.xml");
      p2pScheduler = initScheduler("tlcSpiderP2PScheduler");
      articleScheduler = initScheduler("tlcSpiderArticleScheduler");
      fundScheduler = initScheduler("tlcSpiderFundScheduler");

    } catch (BeansException e) {
      TLCSpiderLoggerUtil.getLogger().error(ExceptionUtils.getFullStackTrace(e));
      if (null != p2pScheduler) {
        p2pScheduler.shutdown();
      }
      if (null != articleScheduler) {
        articleScheduler.shutdown();
      }
      if (null != fundScheduler) {
        fundScheduler.shutdown();
      }
    }
  }