记得上下班打卡 | git大法好,push需谨慎

Commit 4e336549 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/consumer_unite' into dev_bd_rm_consumer_od

parents aa51134d 98143871
...@@ -3,7 +3,6 @@ package com.liquidnet.commons.lang.util; ...@@ -3,7 +3,6 @@ package com.liquidnet.commons.lang.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.liquidnet.commons.lang.util.spring.RestTemplateConfig; import com.liquidnet.commons.lang.util.spring.RestTemplateConfig;
import com.liquidnet.commons.lang.util.spring.RestTemplateOkConfig;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
...@@ -21,9 +20,9 @@ public class HttpUtil { ...@@ -21,9 +20,9 @@ public class HttpUtil {
static { static {
//apache httpClient //apache httpClient
// restTemplate = RestTemplateConfig.getRestTemplate(); restTemplate = RestTemplateConfig.getRestTemplate();
//okhttp3 client // //okhttp3 client
restTemplate = RestTemplateOkConfig.getRestTemplate(); // restTemplate = RestTemplateOkConfig.getRestTemplate();
} }
/** /**
......
...@@ -29,7 +29,7 @@ public class RestTemplateConfig { ...@@ -29,7 +29,7 @@ public class RestTemplateConfig {
static { static {
// 长链接保持时间长度20秒 // 长链接保持时间长度20秒
PoolingHttpClientConnectionManager poolConnManager = PoolingHttpClientConnectionManager poolConnManager =
new PoolingHttpClientConnectionManager(20, TimeUnit.SECONDS); new PoolingHttpClientConnectionManager(20, TimeUnit.MINUTES);
// 设置最大链接数 // 设置最大链接数
poolConnManager.setMaxTotal(80 * getMaxCpuCore() * 5); poolConnManager.setMaxTotal(80 * getMaxCpuCore() * 5);
// 单路由的并发数 // 单路由的并发数
...@@ -48,11 +48,11 @@ public class RestTemplateConfig { ...@@ -48,11 +48,11 @@ public class RestTemplateConfig {
HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory = new HttpComponentsClientRestfulHttpRequestFactory(httpClient); HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory = new HttpComponentsClientRestfulHttpRequestFactory(httpClient);
// 链接超时配置 5秒 // 链接超时配置 5秒
httpComponentsClientHttpRequestFactory.setConnectTimeout(5000); httpComponentsClientHttpRequestFactory.setConnectTimeout(120000);
// 连接读取超时配置 // 连接读取超时配置
// httpComponentsClientHttpRequestFactory.setReadTimeout(10000); httpComponentsClientHttpRequestFactory.setReadTimeout(120000);
// 连接池不够用时候等待时间长度设置,分词那边 500毫秒 ,我们这边设置成1秒 // 连接池不够用时候等待时间长度设置,分词那边 500毫秒 ,我们这边设置成1秒
httpComponentsClientHttpRequestFactory.setConnectionRequestTimeout(5000); httpComponentsClientHttpRequestFactory.setConnectionRequestTimeout(120000);
// 缓冲请求数据,POST大量数据,可以设定为true 我们这边机器比较内存较大 // 缓冲请求数据,POST大量数据,可以设定为true 我们这边机器比较内存较大
httpComponentsClientHttpRequestFactory.setBufferRequestBody(true); httpComponentsClientHttpRequestFactory.setBufferRequestBody(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment