Ejemplo n.º 1
0
 public static void teardown() {
   if (schedulerService != null) {
     try {
       schedulerService.shutdownScheduler();
     } catch (final SchedulerException e) {
       log.error(e, "Failed to shut down the Oskari scheduler");
     }
   }
   DS_HELPER.teardown();
   JedisManager.shutdown();
   log.info("Context destroy");
 }
Ejemplo n.º 2
0
  public static void init() {
    try {
      if (!propsLoaded) {
        loadProperties();
      }
      // catch all so we don't get mysterious listener start errors
      log.info(STR_LOG_LINE);
      log.info("Oskari-map context is being initialized");
      initializeOskariContext();

      // create initial content if properties tells us to
      if ("true".equals(PropertyUtil.getOptional("oskari.init.db"))) {
        log.info("- checking for initial db content");
        DBHandler.createContentIfNotCreated(DS_HELPER.getDataSource());
      }

      migrateDB();

      // init jedis
      log.info("Initializing Redis connections");
      JedisManager.connect(
          ConversionHelper.getInt(PropertyUtil.get(KEY_REDIS_POOL_SIZE), 30),
          PropertyUtil.get(KEY_REDIS_HOSTNAME, "localhost"),
          ConversionHelper.getInt(PropertyUtil.get(KEY_REDIS_PORT), 6379));
      log.info("Oskari-map context initialization done");
      log.info(STR_LOG_LINE);
    } catch (Exception ex) {
      log.error(ex, "!!! Error initializing context for Oskari !!!");
    }

    schedulerService = new SchedulerService();
    try {
      schedulerService.initializeScheduler();
    } catch (final SchedulerException e) {
      log.error(e, "Failed to start up the Oskari scheduler");
    }
  }