public RetryPolicy withMaxDuration(long maxDuration,TimeUnit timeUnit){
  Assert.notNull(timeUnit,"timeUnit");
  Assert.state(timeUnit.toNanos(maxDuration) > delay.toNanos(),"maxDuration must be greater than the delay");
  this.maxDuration=new Duration(maxDuration,timeUnit);
  return this;
}

public RetryPolicy withMaxDuration ( long maxDuration , TimeUnit timeUnit ) { Assert . notNull ( timeUnit , "timeUnit" ) ; Assert . state ( timeUnit . toNanos ( maxDuration ) > delay . toNanos ( ) , "maxDuration must be greater than the delay" ) ; this . maxDuration = new Duration ( maxDuration , timeUnit ) ; return this ; }
sets the max duration to perform retries for , else the execution will be failed .
