class AttemptAndTimeBoundedExponentialBackOff extends AttemptBoundedExponentialBackOff {

  @Override
  public long nextBackOffMillis() {
    if (atMaxAttempts()) {
      return BackOff.STOP;
    }
    long backoff = Math.min(super.nextBackOffMillis(), endTimeMillis - getTimeMillis());
    return (backoff > 0 ? backoff : BackOff.STOP);
  }

  public  AttemptAndTimeBoundedExponentialBackOff(
      int maximumNumberOfAttempts, long initialIntervalMillis, long maximumTotalWaitTimeMillis);
  public  AttemptAndTimeBoundedExponentialBackOff(
      int maximumNumberOfAttempts,
      long initialIntervalMillis,
      long maximumTotalWaitTimeMillis,
      ResetPolicy resetPolicy);
  public  AttemptAndTimeBoundedExponentialBackOff(
      int maximumNumberOfAttempts,
      long initialIntervalMillis,
      long maximumTotalWaitTimeMillis,
      ResetPolicy resetPolicy,
      NanoClock nanoClock);

}