Package org.apache.druid.rpc
Class StandardRetryPolicy
java.lang.Object
org.apache.druid.rpc.StandardRetryPolicy
- All Implemented Interfaces:
ServiceRetryPolicy
Retry policy configurable with a maximum number of attempts and min/max wait time.
The policy retries on IOExceptions and ChannelExceptions, and on HTTP 500, 502, 503, and 504. Other exceptions
and other HTTP status codes are considered nonretryable errors.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.druid.rpc.ServiceRetryPolicy
UNLIMITED -
Method Summary
Modifier and TypeMethodDescriptionstatic StandardRetryPolicyRetry policy that uses up to about an hour of total wait time.static StandardRetryPolicy.Builderbuilder()longReturns the maximum number of desired attempts, orServiceRetryPolicy.UNLIMITEDif unlimited.longReturns the maximum wait time between retries.longReturns the minimum wait time between retries.static StandardRetryPolicyRetry policy that never retries.booleanretryHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse response) Returns whether the given HTTP response can be retried.booleanReturns whether to log the cause of failure before retryingbooleanReturns whether service-not-available, i.e.booleanReturns whether the given exception can be retried.static StandardRetryPolicyStandard unlimited retry policy.static StandardRetryPolicyStandard unlimited retry policy along with muted the logging for the retries.
-
Method Details
-
builder
-
unlimited
Standard unlimited retry policy. Never stops retrying as long as errors remain retryable. SeeServiceClientdocumentation for details on what errors are retryable. -
unlimitedWithoutRetryLogging
Standard unlimited retry policy along with muted the logging for the retries. -
aboutAnHour
Retry policy that uses up to about an hour of total wait time. Note that this is just the total waiting time between attempts. It does not include the time that each attempt takes to execute. -
noRetries
Retry policy that never retries. -
maxAttempts
public long maxAttempts()Description copied from interface:ServiceRetryPolicyReturns the maximum number of desired attempts, orServiceRetryPolicy.UNLIMITEDif unlimited. A value of 1 means no retries. Zero is invalid.- Specified by:
maxAttemptsin interfaceServiceRetryPolicy
-
minWaitMillis
public long minWaitMillis()Description copied from interface:ServiceRetryPolicyReturns the minimum wait time between retries.- Specified by:
minWaitMillisin interfaceServiceRetryPolicy
-
maxWaitMillis
public long maxWaitMillis()Description copied from interface:ServiceRetryPolicyReturns the maximum wait time between retries.- Specified by:
maxWaitMillisin interfaceServiceRetryPolicy
-
retryHttpResponse
public boolean retryHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse response) Description copied from interface:ServiceRetryPolicyReturns whether the given HTTP response can be retried. The response will have a non-2xx error code.- Specified by:
retryHttpResponsein interfaceServiceRetryPolicy
-
retryThrowable
Description copied from interface:ServiceRetryPolicyReturns whether the given exception can be retried.- Specified by:
retryThrowablein interfaceServiceRetryPolicy
-
retryLoggable
public boolean retryLoggable()Description copied from interface:ServiceRetryPolicyReturns whether to log the cause of failure before retrying- Specified by:
retryLoggablein interfaceServiceRetryPolicy
-
retryNotAvailable
public boolean retryNotAvailable()Description copied from interface:ServiceRetryPolicyReturns whether service-not-available, i.e. emptyServiceLocations.getLocations(), can be retried.- Specified by:
retryNotAvailablein interfaceServiceRetryPolicy
-