Пример #1
0
  public void contextInitialized(ServletContextEvent event) {
    super.contextInitialized(event);

    final CmsServiceClient cmsService =
        SpringContextHelper.getBean("cmsClient", CmsServiceClient.class);
    final String baseDir = event.getServletContext().getRealPath("/");

    CmsServiceClient.EDU_APP_BASEDIR = baseDir;
    logger.info("contextInitialized", "※---------{} init---> get cms homeTops start.");
    new Thread(
            new Runnable() {
              public void run() {
                try {
                  cmsService.getHomeTops(baseDir, new ArrayList<Map<String, String>>());
                  logger.info(
                      "contextInitialized",
                      baseDir,
                      "※---------{} init---> get cms homeTops End the base dir is {}.");
                } catch (Exception e) {
                  logger.error("※---------{} init error:{}", e, "contextInitialized");
                }
              }
            })
        .start();
  }
Пример #2
0
 /** 清空所有缓存 */
 public void clearAllCache() {
   SpringContextHelper.instance.getOscache().clear();
   try {
     System.out.println("---clearAllCache-1--");
     String baseDir =
         EDU_APP_BASEDIR; // ServletActionContext.getServletContext().getRealPath("/");
     System.out.println("---clearAllCache-2--");
     getHomeTops(baseDir, new ArrayList<Map<String, String>>());
     System.out.println("---clearAllCache-3--");
   } catch (Exception e) {
     log.error("clearAllCache", "{} called.加载应用信息失败:{}", e);
   }
   log.info("clearAllCache", "{} called.清空所有缓存完成。");
 }