From 09aad11fd10ad97988dc1e920ca9a3d3535e672d Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Thu, 4 May 2017 20:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E7=94=A8=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE10s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xxl/job/core/util/HttpClientUtil.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java index 6d1af0d8..b08cc6aa 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java @@ -2,6 +2,7 @@ package com.xxl.job.core.util; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ContentType; @@ -39,6 +40,12 @@ public class HttpClientUtil { } httpPost.setEntity(new UrlEncodedFormEntity(formParams, "UTF-8")); }*/ + + // timeout + RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000).build(); + httpPost.setConfig(requestConfig); + + // data if (date != null) { httpPost.setEntity(new ByteArrayEntity(date, ContentType.DEFAULT_BINARY)); }