private static void awaitNextRetry(final Throwable e, final int nTry, final boolean quiet) throws InterruptedException { final long sleepMillis = nextRetrySleepMillis(nTry); if (quiet) { log.debug(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } else { log.warn(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } Thread.sleep(sleepMillis); }
private void addNextSyncToWorkQueue() { if (consecutiveFailedAttemptCount > 0) { try { long sleepMillis = RetryUtils.nextRetrySleepMillis(consecutiveFailedAttemptCount); log.info("Scheduling next syncup in [%d] millis from server [%s].", sleepMillis, druidServer.getName()); executor.schedule( addToQueueRunnable, sleepMillis, TimeUnit.MILLISECONDS ); } catch (Exception ex) { log.makeAlert( ex, "WTF! Couldn't schedule next sync. Server[%s] is not being synced any more, restarting Druid process on that server might fix the issue.", druidServer.getName() ).emit(); } } else { addToQueueRunnable.run(); } }