Package org.apache.druid.rpc.indexing
Class SpecificTaskRetryPolicy
- java.lang.Object
-
- org.apache.druid.rpc.indexing.SpecificTaskRetryPolicy
-
- All Implemented Interfaces:
ServiceRetryPolicy
public class SpecificTaskRetryPolicy extends Object implements ServiceRetryPolicy
Retry policy for tasks. Meant to be used together withSpecificTaskServiceLocator. Returns true fromretryHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse)when encountering an HTTP 400 or HTTP 404 with aChatHandlerResource.TASK_ID_HEADERheader for a different task. This can happen when a task is suspended and then later restored in a different location, and then some *other* task reuses its old port. This task-mismatch scenario is retried indefinitely, since we expect that theSpecificTaskServiceLocatorwill update the location at some point.
-
-
Field Summary
-
Fields inherited from interface org.apache.druid.rpc.ServiceRetryPolicy
UNLIMITED
-
-
Constructor Summary
Constructors Constructor Description SpecificTaskRetryPolicy(String taskId, ServiceRetryPolicy baseRetryPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longmaxAttempts()Returns the maximum number of desired attempts, orServiceRetryPolicy.UNLIMITEDif unlimited.longmaxWaitMillis()Returns the maximum wait time between retries.longminWaitMillis()Returns the minimum wait time between retries.booleanretryHttpResponse(org.jboss.netty.handler.codec.http.HttpResponse response)Returns whether the given HTTP response can be retried.booleanretryLoggable()Returns whether to log the cause of failure before retryingbooleanretryNotAvailable()Returns whether service-not-available, i.e.booleanretryThrowable(Throwable t)Returns whether the given exception can be retried.
-
-
-
Constructor Detail
-
SpecificTaskRetryPolicy
public SpecificTaskRetryPolicy(String taskId, ServiceRetryPolicy baseRetryPolicy)
-
-
Method Detail
-
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
public boolean retryThrowable(Throwable t)
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
-
-