/** {@inheritDoc} */ @Override protected void preparePaintComponent(final Request request) { super.preparePaintComponent(request); if (Cache.getCache().get(DATA_KEY) != null) { poller.disablePoll(); } }
@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"); }
/** 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(); }