mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-29 01:18:36 +08:00 
			
		
		
		
	添加DNS解析器支持 (#171) fix
This commit is contained in:
		| @ -1,4 +1,4 @@ | ||||
| package me.chanjar.weixin.common.util.http; | ||||
| package me.chanjar.weixin.common.util.http.apache; | ||||
|  | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.http.annotation.NotThreadSafe; | ||||
| @ -30,7 +30,7 @@ import java.util.concurrent.atomic.AtomicBoolean; | ||||
|  | ||||
| /** | ||||
|  * httpclient 连接管理器 自带DNS解析 | ||||
|  *  | ||||
|  * | ||||
|  * 大部分代码拷贝自:DefaultApacheHttpClientBuilder | ||||
|  * | ||||
|  * @author Andy.Huo | ||||
| @ -62,7 +62,7 @@ public class ApacheHttpDnsClientBuilder implements ApacheHttpClientBuilder { | ||||
| 	private int httpProxyPort; | ||||
| 	private String httpProxyUsername; | ||||
| 	private String httpProxyPassword; | ||||
| 	 | ||||
|  | ||||
| 	/** | ||||
| 	 * 闲置连接监控线程 | ||||
| 	 */ | ||||
| @ -207,7 +207,7 @@ public class ApacheHttpDnsClientBuilder implements ApacheHttpClientBuilder { | ||||
| 		Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() | ||||
| 				.register("http", this.plainConnectionSocketFactory).register("https", this.sslConnectionSocketFactory) | ||||
| 				.build(); | ||||
| 		 | ||||
|  | ||||
| 		@SuppressWarnings("resource") | ||||
| 		PoolingHttpClientConnectionManager connectionManager; | ||||
| 		if(dnsResover != null){ | ||||
| @ -221,7 +221,7 @@ public class ApacheHttpDnsClientBuilder implements ApacheHttpClientBuilder { | ||||
| 			} | ||||
| 			connectionManager = new PoolingHttpClientConnectionManager(registry); | ||||
| 		} | ||||
| 		  | ||||
|  | ||||
| 		connectionManager.setMaxTotal(this.maxTotalConn); | ||||
| 		connectionManager.setDefaultMaxPerRoute(this.maxConnPerHost); | ||||
| 		connectionManager | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang