static RetryPolicy valueOf(TableRetryPolicy policy) {
    // max retries default changed to 2 in v2.0. switching back to infinite retries by default for back compat.
    RetryPolicy failSafePolicy = new RetryPolicy().withMaxRetries(-1);

    switch (policy.getBackoffType()) {
      case NONE:
        break;

      case FIXED:
        failSafePolicy.withDelay(policy.getSleepTime());
        break;

      case RANDOM:
        failSafePolicy.withDelay(policy.getRandomMin().toMillis(), policy.getRandomMax().toMillis(), ChronoUnit.MILLIS);
        break;

      case EXPONENTIAL:
        failSafePolicy.withBackoff(policy.getSleepTime().toMillis(), policy.getExponentialMaxSleep().toMillis(),
            ChronoUnit.MILLIS, policy.getExponentialFactor());
        break;

      default:
        throw new SamzaException("Unknown retry policy type.");
    }

    if (policy.getMaxDuration() != null) {
      failSafePolicy.withMaxDuration(policy.getMaxDuration());
    }
    if (policy.getMaxAttempts() != null) {
      failSafePolicy.withMaxRetries(policy.getMaxAttempts());
    }
    if (policy.getJitter() != null && policy.getBackoffType() != TableRetryPolicy.BackoffType.RANDOM) {
      failSafePolicy.withJitter(policy.getJitter());
    }

    failSafePolicy.abortOn(policy.getRetryPredicate().negate());
    return failSafePolicy;
  }
Convert the {@link TableRetryPolicy} to failsafe {@link RetryPolicy}.
@return this policy instance
samza-core/src/main/java/org/apache/samza/table/retry/FailsafeAdapter.java