コード例 #1
0
ファイル: StartupBean.java プロジェクト: Tomvl117/commafeed
  @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);
            }
          });
    }
  }
コード例 #2
0
ファイル: BasePage.java プロジェクト: haiger/commafeed
  @Override
  public void renderHead(IHeaderResponse response) {
    super.renderHead(response);

    if (getApplication().getConfigurationType() == RuntimeConfigurationType.DEPLOYMENT) {
      long startupTime = startupBean.getStartupTime();
      String suffix = "?" + startupTime;
      response.render(JavaScriptHeaderItem.forUrl("static/all.js" + suffix));
      response.render(CssHeaderItem.forUrl("static/all.css" + suffix));
    } else {
      response.render(JavaScriptHeaderItem.forUrl("wro/lib.js"));
      response.render(CssHeaderItem.forUrl("wro/lib.css"));
      response.render(CssHeaderItem.forUrl("wro/app.css"));

      response.render(JavaScriptHeaderItem.forUrl("js/welcome.js"));
      response.render(JavaScriptHeaderItem.forUrl("js/main.js"));
      response.render(JavaScriptHeaderItem.forUrl("js/controllers.js"));
      response.render(JavaScriptHeaderItem.forUrl("js/directives.js"));
      response.render(JavaScriptHeaderItem.forUrl("js/filters.js"));
      response.render(JavaScriptHeaderItem.forUrl("js/services.js"));
    }

    if (StringUtils.isNotBlank(settings.getGoogleAnalyticsTrackingCode())) {
      Map<String, Object> vars = Maps.newHashMap();
      vars.put("trackingCode", settings.getGoogleAnalyticsTrackingCode());
      WicketUtils.loadJS(response, BasePage.class, "analytics", vars);
    }
  }
コード例 #3
0
 @PostConstruct
 public void init() {
   ApplicationSettings settings = applicationSettingsService.get();
   int threads = Math.max(settings.getDatabaseUpdateThreads(), 1);
   pool = new FeedRefreshExecutor("feed-refresh-updater", threads, Math.min(50 * threads, 1000));
   locks = Striped.lazyWeakLock(threads * 100000);
 }
コード例 #4
0
ファイル: StartupBean.java プロジェクト: Tomvl117/commafeed
  private void initialData() {
    log.info("Populating database with default values");

    ApplicationSettings settings = new ApplicationSettings();
    settings.setAnnouncement("Set the Public URL in the admin section !");
    applicationSettingsService.save(settings);

    userService.register(USERNAME_ADMIN, "admin", Arrays.asList(Role.ADMIN, Role.USER));
    userService.register(USERNAME_DEMO, "demo", Arrays.asList(Role.USER));
  }