Class HttpRetryOptions
-
- All Implemented Interfaces:
public abstract class HttpRetryOptions extends JsonSerializable
HTTP retry options to be used in each of the requests.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classHttpRetryOptions.BuilderBuilder for HttpRetryOptions.
-
Field Summary
Fields Modifier and Type Field Description public final static StringMAX_READ_LENGTH_PROPERTY
-
Constructor Summary
Constructors Constructor Description HttpRetryOptions()
-
Method Summary
Modifier and Type Method Description abstract Optional<Integer>attempts()Maximum number of attempts, including the original request. abstract Optional<Double>initialDelay()Initial delay before the first retry, in fractions of a second. abstract Optional<Double>maxDelay()Maximum delay between retries, in fractions of a second. abstract Optional<Double>expBase()Multiplier by which the delay increases after each attempt. abstract Optional<Double>jitter()Randomness factor for the delay. abstract Optional<List<Integer>>httpStatusCodes()List of HTTP status codes that should trigger a retry. static HttpRetryOptions.Builderbuilder()Instantiates a builder for HttpRetryOptions. abstract HttpRetryOptions.BuildertoBuilder()Creates a builder with the same values as this instance. static HttpRetryOptionsfromJson(String jsonString)Deserializes a JSON string to a HttpRetryOptions object. -
Methods inherited from class com.google.genai.JsonSerializable
fromJsonNode, fromJsonString, objectMapper, setMaxReadLength, stringToJsonNode, toJson, toJsonNode, toJsonString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
attempts
abstract Optional<Integer> attempts()
Maximum number of attempts, including the original request. If 0 or 1, it means no retries. If not specified, default to 5.
-
initialDelay
abstract Optional<Double> initialDelay()
Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.
-
maxDelay
abstract Optional<Double> maxDelay()
Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.
-
expBase
abstract Optional<Double> expBase()
Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.
-
jitter
abstract Optional<Double> jitter()
Randomness factor for the delay. If not specified, default to 1.0.
-
httpStatusCodes
abstract Optional<List<Integer>> httpStatusCodes()
List of HTTP status codes that should trigger a retry. If not specified, a default set of retryable codes (408, 429, and 5xx) may be used.
-
builder
static HttpRetryOptions.Builder builder()
Instantiates a builder for HttpRetryOptions.
-
toBuilder
abstract HttpRetryOptions.Builder toBuilder()
Creates a builder with the same values as this instance.
-
fromJson
static HttpRetryOptions fromJson(String jsonString)
Deserializes a JSON string to a HttpRetryOptions object.
-
-
-
-