All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finagle.service.RetryBudgets Maven / Gradle / Ivy

There is a newer version: 7.0.0
Show newest version
package com.twitter.finagle.service;

import com.twitter.util.Duration;
import com.twitter.util.Stopwatches;

/**
 * Java APIs for {@link RetryBudget}.
 */
public final class RetryBudgets {

  private RetryBudgets() {
    throw new IllegalStateException();
  }

  /**
   * See {@link RetryBudget$#Empty()}
   */
  public static final RetryBudget EMPTY = RetryBudget$.MODULE$.Empty();

  /**
   * See {@link RetryBudget$#Infinite()}
   */
  public static final RetryBudget INFINITE = RetryBudget$.MODULE$.Infinite();

  /**
   * See {@link RetryBudget$#apply()}
   */
  public static RetryBudget newRetryBudget() {
    return RetryBudget$.MODULE$.apply();
  }

  /**
   * See {@link RetryBudget$#apply()}
   */
  public static RetryBudget newRetryBudget(
    Duration ttl,
    int minRetriesPerSec,
    double percentCanRetry
  ) {
    return RetryBudget$.MODULE$.apply(
        ttl,
        minRetriesPerSec,
        percentCanRetry,
        Stopwatches.systemMillis());
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy