in src/main/java/com/microsoft/azure/datalake/store/oauth2/AzureADAuthenticator.java [195:234]
private static AzureADToken getTokenCall(String authEndpoint, String body, Hashtable<String, String> headers, String httpMethod, RetryPolicy retryPolicy)
throws IOException {
AzureADToken token = null;
RetryPolicy retryPolicyUsed;
retryPolicyUsed = (retryPolicy != null) ?
retryPolicy : new ExponentialBackoffPolicy(3, 0, 1000, 2);
int httperror = 0;
String requestId;
String httpExceptionMessage = null;
IOException ex = null;
boolean succeeded = false;
String clientRequestId = UUID.randomUUID().toString();
int retryCount = 0;
if(headers == null){
headers = new Hashtable<String, String>();
}
do {
httperror = 0;
ex = null;
try {
headers.put("client-request-id", clientRequestId + "."+retryCount);
token = getTokenSingleCall(authEndpoint, body, headers, httpMethod);
retryCount++;
} catch (HttpException e) {
httperror = e.httpErrorCode;
requestId = e.requestId;
httpExceptionMessage = e.getMessage();
} catch (IOException e) {
ex = e;
}
succeeded = ((httperror == 0) && (ex == null));
} while (!succeeded && retryPolicyUsed.shouldRetry(httperror, ex));
if (!succeeded) {
if (ex != null) throw ex;
if (httperror!=0) throw new IOException(httpExceptionMessage);
}
return token;
}