/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.retry;

import alluxio.util.CommonUtils;

import com.google.common.base.Preconditions;

import javax.annotation.concurrent.NotThreadSafe;

/**
 * An option which allows retrying based on a maximum retry timeout.
 */
@NotThreadSafe
public class TimeoutRetry implements RetryPolicy {

  private final long mRetryTimeoutMs;
  private long mStartMs = 0;
  private int mCount = 0;

  /**
   * Constructs a retry facility which allows a maximum retry timeout.
   *
   * @param retryTimeoutMs maximum period of time to retry for, in milliseconds
   */
  public TimeoutRetry(long retryTimeoutMs) {
    Preconditions.checkArgument(retryTimeoutMs > 0, "Retry timeout must be a positive number");
    mRetryTimeoutMs = retryTimeoutMs;
  }

  @Override
  public int getRetryCount() {
    return mCount;
  }

  @Override
  public boolean attemptRetry() {
    if (mCount == 0) {
      // first attempt
      mStartMs = CommonUtils.getCurrentMs();
      mCount++;
      return true;
    }

    if ((CommonUtils.getCurrentMs() - mStartMs) <= mRetryTimeoutMs) {
      mCount++;
      return true;
    }
    return false;
  }
}

@@ -674,16 +674,21 @@
  * A
-n option
+ retry policy
  whi

Fix javadoc comment