/** * 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 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); } }
@Override public synchronized long getSleepAndIncrement() { long next = super.getSleepAndIncrement(); next = (long) (next * (1 + r.nextFloat() * (getMultiplier() - 1))); return next; }
public synchronized long getSleepAndIncrement() { long sleep = this.interval; if (sleep > maxInterval) { sleep = maxInterval; } else { this.interval = getNextInterval(); } return sleep; }
/** * Returns a new instance of {@link BackOffContext} configured with the 'expSeed' and * 'increment' values. */ public BackOffContext start(RetryContext context) { return new ExponentialBackOffContext(this.initialInterval, this.multiplier, this.maxInterval); }
@Override public synchronized long getSleepAndIncrement() { long next = super.getSleepAndIncrement(); next = (long) (next * (1 + r.nextFloat() * (getMultiplier() - 1))); return next; }
public synchronized long getSleepAndIncrement() { long sleep = this.interval; if (sleep > maxInterval) { sleep = maxInterval; } else { this.interval = getNextInterval(); } return sleep; }
/** * Returns a new instance of {@link BackOffContext} configured with the 'expSeed' and * 'increment' values. */ public BackOffContext start(RetryContext context) { return new ExponentialBackOffContext(this.initialInterval, this.multiplier, this.maxInterval); }