Java Code Examples for org.apache.ratis.util.TimeDuration#getDuration()

The following examples show how to use org.apache.ratis.util.TimeDuration#getDuration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RetryPolicies.java    From ratis with Apache License 2.0 5 votes vote down vote up
RetryForeverWithSleep(TimeDuration sleepTime) {
  if (sleepTime.isNegative()) {
    throw new IllegalArgumentException(
        "sleepTime = " + sleepTime.getDuration() + " < 0");
  }
  this.sleepTime = sleepTime;
}
 
Example 2
Source File: RetryPolicies.java    From ratis with Apache License 2.0 5 votes vote down vote up
RetryLimited(int maxAttempts, TimeDuration sleepTime) {
  if (maxAttempts < 0) {
    throw new IllegalArgumentException("maxAttempts = " + maxAttempts+" < 0");
  }
  if (sleepTime.isNegative()) {
    throw new IllegalArgumentException(
        "sleepTime = " + sleepTime.getDuration() + " < 0");
  }

  this.maxAttempts = maxAttempts;
  this.sleepTime = sleepTime;
}