RetryPolicy
Stay organized with collections
Save and categorize content based on your preferences.
Object to store policy parameters used for backoff and retry recoverable errors.
Store the maximum allowable number of retries and the back-off algorithm (typically an
exponential back-off) to use when recoverable HTTP errors occur.
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Constants
public
static
final
String
CONFIG_MAXIMUM_RETRIES
Constant Value:
"maxRetryLimit"
public
static
final
int
DEFAULT_MAXIMUM_RETRIES
Public Methods
public
static
RetryPolicy
fromConfiguration
()
Creates a retry policy using parameters specified in connector configuration file.
maxRetryLimit=5
- maximum number of
retries of failed (but recoverable) API calls.
public
int
getMaxRetryLimit
()
Gets maximum number of times a failed request would be retried before marking request as
failed.
public
boolean
isRetryableStatusCode
(int statusCode)
Checks if request with statusCode
response is retryable.
Returns
- true if request with
statusCode
response is retryable, false otherwise.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["public class **RetryPolicy** extends Object \nObject to store policy parameters used for backoff and retry recoverable errors.\n\nStore the maximum allowable number of retries and the back-off algorithm (typically an\nexponential back-off) to use when recoverable HTTP errors occur. \n\nNested Class Summary\n\n|-----------|---|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| interface | [RetryPolicy.BackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.BackOffFactory) || Creates an instance of [BackOff](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/util/BackOff) |\n| class | [RetryPolicy.Builder](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.Builder) || Builder for creating an instance of [RetryPolicy](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy) |\n| class | [RetryPolicy.DefaultBackOffFactoryImpl](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.DefaultBackOffFactoryImpl) || Default factory object used to create an [ExponentialBackOff](/workspace/cloud-search/docs/reference/sdk/com/google/api/client/util/ExponentialBackOff) with an initial delay of 1 second(s) and a multiplier of 2. |\n\nConstant Summary\n\n|--------|-------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| String | [CONFIG_MAXIMUM_RETRIES](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#CONFIG_MAXIMUM_RETRIES) | |\n| int | [DEFAULT_MAXIMUM_RETRIES](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#DEFAULT_MAXIMUM_RETRIES) | |\n\nPublic Method Summary\n\n|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [RetryPolicy](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy) | [fromConfiguration](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#fromConfiguration())() Creates a retry policy using parameters specified in connector configuration file. |\n| [RetryPolicy.BackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.BackOffFactory) | [getBackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#getBackOffFactory())() Gets [RetryPolicy.BackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.BackOffFactory) instance used for cmputing exponential back off. |\n| int | [getMaxRetryLimit](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#getMaxRetryLimit())() Gets maximum number of times a failed request would be retried before marking request as failed. |\n| boolean | [isRetryableStatusCode](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy#isRetryableStatusCode(int))(int statusCode) Checks if request with `statusCode` response is retryable. |\n\nInherited Method Summary \nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nConstants \n\npublic static final String\n**CONFIG_MAXIMUM_RETRIES** \n\u003cbr /\u003e\n\nConstant Value: \"maxRetryLimit\" \n\npublic static final int\n**DEFAULT_MAXIMUM_RETRIES** \n\u003cbr /\u003e\n\nConstant Value: 5\n\nPublic Methods \n\npublic static [RetryPolicy](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy)\n**fromConfiguration**\n() \nCreates a retry policy using parameters specified in connector configuration file.\n\n- `maxRetryLimit=5` - maximum number of retries of failed (but recoverable) API calls.\n\n\u003cbr /\u003e\n\npublic [RetryPolicy.BackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.BackOffFactory)\n**getBackOffFactory**\n() \nGets [RetryPolicy.BackOffFactory](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/RetryPolicy.BackOffFactory) instance used for cmputing exponential back off. \n\npublic int\n**getMaxRetryLimit**\n() \nGets maximum number of times a failed request would be retried before marking request as\nfailed. \n\npublic boolean\n**isRetryableStatusCode**\n(int statusCode) \nChecks if request with `statusCode` response is retryable. \n\nParameters\n\n| statusCode | to check |\n|------------|----------|\n\nReturns\n\n- true if request with `statusCode` response is retryable, false otherwise."]]