Class RetriableStream.Throttle

java.lang.Object
io.grpc.internal.RetriableStream.Throttle
Enclosing class:
RetriableStream<ReqT>

static final class RetriableStream.Throttle extends Object
Used for retry throttling.
  • Field Details

    • THREE_DECIMAL_PLACES_SCALE_UP

      private static final int THREE_DECIMAL_PLACES_SCALE_UP
      See Also:
    • maxTokens

      final int maxTokens
      1000 times the maxTokens field of the retryThrottling policy in service config. The number of tokens starts at maxTokens. The token_count will always be between 0 and maxTokens.
    • threshold

      final int threshold
      Half of maxTokens.
    • tokenRatio

      final int tokenRatio
      1000 times the tokenRatio field of the retryThrottling policy in service config.
    • tokenCount

      final AtomicInteger tokenCount
  • Constructor Details

    • Throttle

      Throttle(float maxTokens, float tokenRatio)
  • Method Details

    • isAboveThreshold

      boolean isAboveThreshold()
    • onQualifiedFailureThenCheckIsAboveThreshold

      boolean onQualifiedFailureThenCheckIsAboveThreshold()
      Counts down the token on qualified failure and checks if it is above the threshold atomically. Qualified failure is a failure with a retryable or non-fatal status code or with a not-to-retry pushback.
    • onSuccess

      void onSuccess()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object