in src/main/java/com/microsoft/azure/datalake/store/HttpTransport.java [55:130]
static void makeCall (ADLStoreClient client,
Operation op,
String path,
QueryParams queryParams,
byte[] requestBody,
int offsetWithinContentsArray,
int length,
RequestOptions opts,
OperationResponse resp
)
{
if (opts == null) throw new IllegalArgumentException("RequestOptions parameter missing from call");
if (resp == null) throw new IllegalArgumentException("OperationResponse parameter missing from call");
if (opts.retryPolicy == null) {
opts.retryPolicy = new NonIdempotentRetryPolicy();
}
String clientRequestId;
if (opts.requestid == null) {
clientRequestId = UUID.randomUUID().toString();
} else {
clientRequestId = opts.requestid;
}
if (queryParams == null) queryParams = new QueryParams();
queryParams.setOp(op);
queryParams.setApiVersion(API_VERSION);
int retryCount = 0;
do {
opts.requestid = clientRequestId + "." + Integer.toString(retryCount);
resp.reset();
long start = System.nanoTime();
makeSingleCall(client, op, path, queryParams, requestBody, offsetWithinContentsArray, length, opts, resp);
resp.lastCallLatency = System.nanoTime() - start;
resp.lastCallLatency = resp.lastCallLatency / 1000000; // convert from nanoseconds to milliseconds
resp.numRetries = retryCount;
String respLength = (resp.responseChunked ? "chunked" : Long.toString(resp.responseContentLength));
String error = "";
String outcome = null;
if (isSuccessfulResponse(resp, op)) {
resp.successful = true;
outcome = "Succeeded";
LatencyTracker.addLatency(opts.requestid, retryCount, resp.lastCallLatency, op.name,
length + resp.responseContentLength, client.getClientId());
} else {
resp.successful = false;
outcome = "Failed";
if (resp.ex!=null) {
error = resp.ex.getClass().getName();
} else {
error = "HTTP" + resp.httpResponseCode + "(" + resp.remoteExceptionName + ")";
}
LatencyTracker.addError(opts.requestid, retryCount, resp.lastCallLatency, error, op.name,
length, client.getClientId());
retryCount++;
resp.exceptionHistory = resp.exceptionHistory == null ? error : resp.exceptionHistory + "," + error;
}
if (log.isDebugEnabled()) {
String logline =
"HTTPRequest," + outcome +
",cReqId:" + opts.requestid +
",lat:" + Long.toString(resp.lastCallLatency) +
",err:" + error +
",Reqlen:" + length +
",Resplen:" + respLength +
",token_ns:" + Long.toString(resp.tokenAcquisitionLatency) +
",sReqId:" + resp.requestId +
",path:" + path +
",qp:" + queryParams.serialize();
log.debug(logline);
}
} while (!resp.successful && opts.retryPolicy.shouldRetry(resp.httpResponseCode, resp.ex));
}