in src/main/java/com/aliyun/openservices/log/Client.java [1353:1399]
public BatchGetLogResponse BatchGetLog(BatchGetLogRequest request) throws LogException {
CodingUtils.assertParameterNotNull(request, "request");
String project = request.GetProject();
CodingUtils.assertStringNotNullOrEmpty(project, "project");
String logStore = request.GetLogStore();
CodingUtils.validateLogstore(logStore);
Map<String, String> headParameter = GetCommonHeadPara(project);
String resourceUri = "/logstores/" + logStore + "/shards/" + request.GetShardId();
CompressType compressType = request.getCompressType();
if (compressType == null || compressType == CompressType.NONE) {
compressType = CompressType.LZ4;
}
headParameter.put(Consts.CONST_ACCEPT_ENCODING, compressType.toString());
headParameter.put(Consts.CONST_HTTP_ACCEPT, Consts.CONST_PROTO_BUF);
Map<String, String> urlParameter = request.GetAllParams();
ResponseMessage response;
BatchGetLogResponse batchGetLogResponse;
for (int i = 0; i < 2; i++) {
String server_ip = this.realServerIP;
ClientConnectionStatus connection_status = null;
if (this.useDirectMode) {
connection_status = GetShardConnectionStatus(project, logStore, request.GetShardId());
server_ip = connection_status.GetIpAddress();
}
try {
response = SendData(project, HttpMethod.GET, resourceUri, urlParameter, headParameter, new byte[0], null,
server_ip);
Map<String, String> resHeaders = response.getHeaders();
byte[] rawData = response.GetRawBody();
batchGetLogResponse = new BatchGetLogResponse(resHeaders, rawData);
if (connection_status != null) {
connection_status.UpdateLastUsedTime(System.nanoTime());
connection_status.AddPullDataSize(batchGetLogResponse.GetRawSize());
}
return batchGetLogResponse;
} catch (LogException e) {
if (i == 1 || e.getRequestId() != null && !e.getRequestId().isEmpty()) {
throw e;
}
if (connection_status != null) {
connection_status.DisableConnection();
}
}
}
return null; // never happen
}