/** * Pause for the {@link #setBackOffPeriod(long)}. * @throws BackOffInterruptedException if interrupted during sleep. */ protected void doBackOff() throws BackOffInterruptedException { try { sleeper.sleep(backOffPeriod); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }
/** * Pause for the {@link #setMinBackOffPeriod(long)}. * @throws BackOffInterruptedException if interrupted during sleep. */ protected void doBackOff() throws BackOffInterruptedException { try { long delta = maxBackOffPeriod==minBackOffPeriod ? 0 : random.nextInt((int) (maxBackOffPeriod - minBackOffPeriod)); sleeper.sleep(minBackOffPeriod + delta ); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }
/** * Pause for a length of time equal to ' <code>exp(backOffContext.expSeed)</code>'. */ public void backOff(BackOffContext backOffContext) throws BackOffInterruptedException { ExponentialBackOffContext context = (ExponentialBackOffContext) backOffContext; try { long sleepTime = context.getSleepAndIncrement(); if (logger.isDebugEnabled()) { logger.debug("Sleeping for " + sleepTime); } sleeper.sleep(sleepTime); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }
/** * Pause for the {@link #setBackOffPeriod(long)}. * @throws BackOffInterruptedException if interrupted during sleep. */ protected void doBackOff() throws BackOffInterruptedException { try { sleeper.sleep(backOffPeriod); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }
/** * Pause for the {@link #setMinBackOffPeriod(long)}. * @throws BackOffInterruptedException if interrupted during sleep. */ protected void doBackOff() throws BackOffInterruptedException { try { long delta = maxBackOffPeriod==minBackOffPeriod ? 0 : random.nextInt((int) (maxBackOffPeriod - minBackOffPeriod)); sleeper.sleep(minBackOffPeriod + delta ); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }
/** * Pause for a length of time equal to ' <code>exp(backOffContext.expSeed)</code>'. */ public void backOff(BackOffContext backOffContext) throws BackOffInterruptedException { ExponentialBackOffContext context = (ExponentialBackOffContext) backOffContext; try { long sleepTime = context.getSleepAndIncrement(); if (logger.isDebugEnabled()) { logger.debug("Sleeping for " + sleepTime); } sleeper.sleep(sleepTime); } catch (InterruptedException e) { throw new BackOffInterruptedException("Thread interrupted while sleeping", e); } }