Пример #1
0
 public void doGet(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   log.info("Starts Init servlet - " + new Date());
   Cursor cursor = initServlet(request);
   if (!Util.inProduction() || (Util.inProduction() && cursor.backend)) {
     startup(cursor);
   } else {
     cursor.setBackend(true);
     createInitBackendTask("slow-queue", cursor);
   }
   log.info("Finished Init servlet - " + new Date());
 }
Пример #2
0
 private void startup(Cursor cursor) {
   try {
     final Date lastSystemRun = parameterService.getLastInitDate();
     if (initializationNeeded(lastSystemRun)) {
       log.info("Init Incisos UEs UCCs...");
       incisoUEUCCService.init();
       log.info("Init Rubro...");
       catalogService.initRubro();
       log.info("Init RubroCatalogo...");
       catalogService.initRubroCatalogo();
       if (lastSystemRun == null) {
         log.info("Init Catalog...");
         catalogService.initCatalog(cursor);
       }
       Date lastModifiedDate = Util.getLastModifiedDate(Util.CATALOG_SQL_URL);
       if (lastModifiedDate != null) {
         log.debug(
             "Last modified date for "
                 + Util.CATALOG_SQL_URL
                 + " is: "
                 + Util.formatDate_DD_MM_YYYY_HH_MM(lastModifiedDate));
         createCatalogBackendTask("medium-queue", lastModifiedDate);
       } else {
         log.error("Last modified date for " + Util.CATALOG_SQL_URL + " is null !");
       }
       parameterService.setLastInitDate(new Date());
       log.info("Date of initialization updated: " + parameterService.getLastInitDate());
     } else {
       log.info("Date of last initialization: " + lastSystemRun + ", exiting initialization.");
       log.debug("Initializing memory cache...");
       catalogService.initRubroCatalogo();
       incisoUEUCCService.initIncisos();
       incisoUEUCCService.initUEs();
       incisoUEUCCService.initEstadoCompras();
       incisoUEUCCService.initTiposCompra();
       incisoUEUCCService.initSubTiposCompra();
       incisoUEUCCService.initTipoResolucion();
       // incisoUEUCCService.initMonedas();
     }
   } catch (SystemException e) {
     log.error("Error on application startup...", e);
   } catch (QuotaException e) {
     log.error(e.getMessage(), e);
     createInitBackendTask("slow-queue", cursor);
   }
 }