Package io.grpc.internal
Class RetriableStream.Throttle
java.lang.Object
io.grpc.internal.RetriableStream.Throttle
- Enclosing class:
RetriableStream<ReqT>
Used for retry throttling.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
1000 times the maxTokens field of the retryThrottling policy in service config.private static final int
(package private) final int
Half ofmaxTokens
.(package private) final AtomicInteger
(package private) final int
1000 times the tokenRatio field of the retryThrottling policy in service config. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
(package private) boolean
(package private) boolean
Counts down the token on qualified failure and checks if it is above the threshold atomically.(package private) void
-
Field Details
-
THREE_DECIMAL_PLACES_SCALE_UP
private static final int THREE_DECIMAL_PLACES_SCALE_UP- See Also:
-
maxTokens
final int maxTokens1000 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 thresholdHalf ofmaxTokens
. -
tokenRatio
final int tokenRatio1000 times the tokenRatio field of the retryThrottling policy in service config. -
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
-
hashCode
public int hashCode()
-