提交 09aad11f authored 作者: xueli.xue's avatar xueli.xue

调用超时时间设置10s

上级 fc5b6fa6
...@@ -2,6 +2,7 @@ package com.xxl.job.core.util; ...@@ -2,6 +2,7 @@ package com.xxl.job.core.util;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
...@@ -39,6 +40,12 @@ public class HttpClientUtil { ...@@ -39,6 +40,12 @@ public class HttpClientUtil {
} }
httpPost.setEntity(new UrlEncodedFormEntity(formParams, "UTF-8")); httpPost.setEntity(new UrlEncodedFormEntity(formParams, "UTF-8"));
}*/ }*/
// timeout
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000).build();
httpPost.setConfig(requestConfig);
// data
if (date != null) { if (date != null) {
httpPost.setEntity(new ByteArrayEntity(date, ContentType.DEFAULT_BINARY)); httpPost.setEntity(new ByteArrayEntity(date, ContentType.DEFAULT_BINARY));
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论