@Override public void run() { long interval = m_syncDelay.get(); while (!isInterrupted()) { try { logDebug("Scheduling controller to run in %d seconds...", interval); TimeUnit.SECONDS.sleep(interval); logDebug("Controller syncing..."); runFeedback(); runAgentUpdate(); runDeploymentUpdate(); interval = m_interval.get(); logDebug("Sync completed..."); } catch (RetryAfterException e) { // any method may throw this causing the sync to abort. The server is busy so no sense in trying // anything else until the retry window has passed. interval = e.getBackoffTime(); logWarning("Sync received retry exception from server. Rescheduled in %d seconds...", interval); } catch (InterruptedException exception) { logDebug(exception.getMessage()); // Ok; break out of our main loop... Thread.currentThread().interrupt(); } } }