コード例 #1
0
  /** {@inheritDoc} */
  @Override
  protected void preparePaintComponent(final Request request) {
    super.preparePaintComponent(request);

    if (Cache.getCache().get(DATA_KEY) != null) {
      poller.disablePoll();
    }
  }
コード例 #2
0
ファイル: CacheListener.java プロジェクト: jtmille3/Comp
  @Override
  public void contextInitialized(final ServletContextEvent arg0) {
    final long startTime = System.currentTimeMillis();

    final Competitive competitive = competitiveService.getCompetition();
    Cache.getCache().setCompetitive(competitive);

    final long elapsedTime = System.currentTimeMillis() - startTime;
    System.out.println(elapsedTime + "ms");
  }
コード例 #3
0
  /** Fakes a service call, using the WorkManager for threading. */
  private void fakeServiceCall() {
    poller.enablePoll();
    Cache.getCache().invalidate(DATA_KEY);

    new Thread() {
      @Override
      public void run() {
        try {
          Thread.sleep(SERVICE_TIME);
          Cache.getCache().put(DATA_KEY, "SUCCESS!");
        } catch (InterruptedException e) {
          LOG.error("Timed out calling service", e);
          Cache.getCache().put(DATA_KEY, "Timed out!");
        }
      }
    }.start();
  }