in src/main/java/com/microsoft/azure/datalake/store/retrypolicies/ExponentialBackoffPolicy.java [46:84]
public boolean shouldRetry(int httpResponseCode, Exception lastException) {
// Non-retryable error
if ( (httpResponseCode >= 300 && httpResponseCode < 500 // 3xx and 4xx, except specific ones below
&& httpResponseCode != 408
&& httpResponseCode != 429
&& httpResponseCode != 401)
|| (httpResponseCode == 501) // Not Implemented
|| (httpResponseCode == 505) // Version Not Supported
) {
return false;
}
// Retryable error, retry with exponential backoff
if ( lastException!=null || httpResponseCode >=500 // exception or 5xx, + specific ones below
|| httpResponseCode == 408
|| httpResponseCode == 429
|| httpResponseCode == 401) {
if (retryCount < maxRetries) {
int timeSpent = (int)((System.nanoTime() - lastAttemptStartTime) / 1000000);
wait(exponentialRetryInterval - timeSpent);
exponentialRetryInterval *= exponentialFactor;
retryCount++;
lastAttemptStartTime = System.nanoTime();
return true;
} else {
return false; // max # of retries exhausted
}
}
// these are not errors - this method should never have been called with this
if (httpResponseCode >= 100 && httpResponseCode <300)
{
return false;
}
// Dont know what happened - we should never get here
return false;
}