ConstantTimeBackoff extends AdapterBase implements BackoffAlgorithm, ConstantTimeBackoffMBean { @Override public void waitBeforeRetry() { Thread current = Thread.currentThread(); try { _asleep.put(current.getName(), current); Thread.sleep(_time); } catch (InterruptedException e) { LOG.info("Thread " + current.getName() + " interrupted while waiting for retry"); } finally { _asleep.remove(current.getName()); } return; }  @Override void waitBeforeRetry(); @Override void reset(); @Override boolean configure(String name, Map<String, Object> params); @Override Collection<String> getWaiters(); @Override boolean wakeup(String threadName); @Override long getTimeToWait(); @Override void setTimeToWait(long seconds);  }
@Test public void waitBeforeRetry() throws InterruptedException { final ConstantTimeBackoff backoff = new ConstantTimeBackoff(); backoff.setTimeToWait(0); Assert.assertTrue(backoff.getWaiters().isEmpty()); backoff.waitBeforeRetry(); Assert.assertTrue(backoff.getWaiters().isEmpty()); }