Apache HttpClient 4.3 SocketConfig.getSoTimeout()与RequestConfig.getSocketTimeout() [英] Apache HttpClient 4.3 SocketConfig.getSoTimeout() vs RequestConfig.getSocketTimeout()

查看:189
本文介绍了Apache HttpClient 4.3 SocketConfig.getSoTimeout()与RequestConfig.getSocketTimeout()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Apache HttpClient 4.3中构建CloseableHttpClient时,我可以使用

When building a CloseableHttpClient in Apache HttpClient 4.3, I can use

SocketConfig.custom().setSoTimeout(soTimeout).build()

并将其发送到我的连接管理器的setDefaultSocketConfig()方法.

and send it to the setDefaultSocketConfig() method of my connection manager.

我也可以使用

RequestConfig.custom().setSocketTimeout(socketTimeout).build()

并将其发送到我的http客户端构建器的setDefaultRequestConfig()方法.

and send it to the setDefaultRequestConfig() method of my http client builder.

这些药物会产生相同的最终结果还是不同的最终结果?

Will these have the same end effect or different end effects?

推荐答案

SocketConfig中的套接字超时代表应用于新创建的连接的默认值.通过在RequestConfig中设置套接字超时的非零值,可以为单个请求覆盖该值.

Socket timeout in SocketConfig represents the default value applied to newly created connections. This value can be overwritten for individual requests by setting a non zero value of socket timeout in RequestConfig.

这篇关于Apache HttpClient 4.3 SocketConfig.getSoTimeout()与RequestConfig.getSocketTimeout()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆