1 Commits

Author SHA1 Message Date
doufenghu
be38915890 fix(batch): 增加无法链接错误计数 2020-10-28 18:57:16 +08:00
3 changed files with 7 additions and 5 deletions

View File

@@ -194,6 +194,7 @@ public class AsyncBatchMsgCallBack implements FutureCallback<HttpResponse> {
*/
@Override
public void failed(Exception e) {
AvroMonitorTimerTask.addFailedNum(count);
logger.error("AsyncPostMagCallBack Request is Failed,This Failed data checksum is ==>"+ checksum);
}

View File

@@ -208,6 +208,7 @@ public class AsyncSingleMsgCallBack implements FutureCallback<HttpResponse> {
*/
@Override
public void failed(Exception e) {
AvroMonitorTimerTask.addFailedNum(count);
logger.error("AsyncSingleMsgCallBack Request is Failed,This Failed data is ==>"
+ dataJson );
}

View File

@@ -175,7 +175,7 @@ public class HttpManager {
LaxRedirectStrategy redirectStrategy = new LaxRedirectStrategy();
ConnectionKeepAliveStrategy myStrategy = (response, context) -> {
/* ConnectionKeepAliveStrategy myStrategy = (response, context) -> {
HeaderElementIterator it = new BasicHeaderElementIterator
(response.headerIterator(HTTP.CONN_KEEP_ALIVE));
while (it.hasNext()) {
@@ -187,7 +187,7 @@ public class HttpManager {
}
}
return 10 * 1000;//如果没有约定则默认定义时长为60s
};
};*/
/**
* 原版
@@ -197,7 +197,7 @@ public class HttpManager {
.setDefaultRequestConfig(requestConfig)
.setRedirectStrategy(redirectStrategy)
.setRetryHandler(myRetryHandler)
.setKeepAliveStrategy(myStrategy)
// .setKeepAliveStrategy(myStrategy)
.build();
return httpClient;
@@ -648,7 +648,7 @@ public class HttpManager {
httpPost.addHeader("User-Agent", userAgent);
httpPost.addHeader("X-Tag", xTag);//根据最新文档,目前已经不需要此头-20191217
httpPost.addHeader("Content-Type", "application/json");
httpPost.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
// httpPost.setHeader(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
StringEntity payload = new StringEntity(data, Charset.forName("utf-8"));
//payload.setContentType("text/xml; charset=UTF-8");
payload.setContentEncoding("utf-8");
@@ -699,7 +699,7 @@ public class HttpManager {
logger.error("释放链接错误: " + e.getMessage());
}
}
//httpPost.abort();
httpPost.abort();
}
return acResBody;
}