Ejemplo n.º 1
0
  @PostConstruct
  private void init() {
    startupTime = Calendar.getInstance().getTimeInMillis();
    if (userDAO.getCount() == 0) {
      initialData();
    }

    initSupportedLanguages();

    ApplicationSettings settings = applicationSettingsService.get();
    int threads = settings.getBackgroundThreads();
    log.info("Starting {} background threads", threads);

    executor = Executors.newFixedThreadPool(Math.max(threads, 1));
    for (int i = 0; i < threads; i++) {
      final int threadId = i;
      executor.execute(
          new Runnable() {
            @Override
            public void run() {
              FeedRefreshWorker worker = workers.get();
              worker.start(running, "Thread " + threadId);
            }
          });
    }
  }