public final class DefaultRetryToken extends Object implements RetryToken, ToCopyableBuilder<DefaultRetryToken.Builder,DefaultRetryToken>
RetryToken implementation. The data contained in this class is not part of the interface but is needed for
the calling code to test and generate meaningful logs using its current state.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultRetryToken.Builder
A builder class to create
DefaultRetryToken instances or to mutate them. |
static class |
DefaultRetryToken.TokenState
Set of possibles states on which the RetryToken can be, in-progress, succeeded and all the possible failure modes.
|
| Modifier and Type | Method and Description |
|---|---|
int |
attempt()
Returns the latest attempt count.
|
static DefaultRetryToken.Builder |
builder()
Returns a new builder to create new instances of the
DefaultRetryToken class. |
int |
capacityAcquired()
Returns the latest capacity acquired from the token bucket.
|
int |
capacityRemaining()
Returns the capacity remaining in the token bucket when the last acquire request was done.
|
String |
scope()
Returns the token scope.
|
DefaultRetryToken.TokenState |
state()
Returns the state of the token.
|
DefaultRetryToken.Builder |
toBuilder()
Creates a new builder to mutate the current instance.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcopypublic int attempt()
public String scope()
public int capacityAcquired()
public int capacityRemaining()
public DefaultRetryToken.TokenState state()
public DefaultRetryToken.Builder toBuilder()
toBuilder in interface ToCopyableBuilder<DefaultRetryToken.Builder,DefaultRetryToken>public static DefaultRetryToken.Builder builder()
DefaultRetryToken class.Copyright © 2026. All rights reserved.