@Override public void fireAction(IAction action) { this.actionFirerer.fireAction(action); }
protected void disableWatchdog() { sendIsBlocking(false); }
/** * Creates a new connector for the given interface. * * @param content * The map. */ public MapInterfaceConnector(MapContent content) { this.content = content; actionFirerer.setBlockingListener(content); }
@Override public void run() { FireringAction action; while (!stopped) { try { synchronized (toFireMutex) { while (toFire.isEmpty() && !stopped) { toFireMutex.wait(); } if (stopped) { break; } action = toFire.poll(); } startWatchdog(action.startTime); fireTo.fireAction(action.action); stopWatchdog(); } catch (Throwable e) { System.err.println("Exception while handling action:"); e.printStackTrace(); if (blockingListener != null) { blockingListener.actionThreadCaughtException(e); } } if (toFire.isEmpty()) { disableWatchdog(); } } } }
/** * Stops all threads related to the graphics display. You may experience crazy results when trying to use the map view afterwards. */ @Override public void shutdown() { actionFirerer.stop(); content.stop(); }
protected void startWatchdog(long startTime) { long destTime = startTime + ACTION_FIRERER_TIMEOUT; long timeUntilFreezeState = System.currentTimeMillis() - destTime; if (timeUntilFreezeState <= 0) { sendIsBlocking(true); } else { watchdogTimerTask = new TimerTask() { @Override public void run() { sendIsBlocking(true); } }; watchdogTimer.schedule(watchdogTimerTask, timeUntilFreezeState); } }