Esempio n. 1
0
 private void runCron(HttpServletRequest request, HttpServletResponse response, String where)
     throws Exception {
   DataBaseDao dataBaseDao = (DataBaseDao) BeanFactory.getBean("dataBaseDao");
   List<Map<String, Object>> query =
       dataBaseDao.executeQuery(
           "SELECT * FROM "
               + JavaCenterHome.getTableName("cron")
               + " WHERE "
               + where
               + " ORDER BY nextrun LIMIT 1");
   if (query.size() > 0) {
     Map<String, Object> cron = query.get(0);
     cronRunning(request, response, cron);
   }
   cron_config(request);
 }
Esempio n. 2
0
  public synchronized void cron_config(HttpServletRequest request) throws Exception {
    DataBaseDao dataBaseDao = (DataBaseDao) BeanFactory.getBean("dataBaseDao");
    List<Map<String, Object>> query =
        dataBaseDao.executeQuery(
            "SELECT nextrun FROM "
                + JavaCenterHome.getTableName("cron")
                + " WHERE available>'0' ORDER BY nextrun LIMIT 1");

    int nextrun = query.size() > 0 ? (Integer) (query.get(0).get("nextrun")) : 0;
    DataBaseService dataBaseService = (DataBaseService) BeanFactory.getBean("dataBaseService");
    Map<String, Object> insertsqlarr = new HashMap<String, Object>();
    insertsqlarr.put("var", "cronnextrun");
    insertsqlarr.put("datavalue", nextrun);
    dataBaseService.insertTable("config", insertsqlarr, false, true);

    CacheService cacheService = (CacheService) BeanFactory.getBean("cacheService");
    cacheService.config_cache(false);
  }