Apache HttpClient 4.3 SocketConfig.getSoTimeout() vs RequestConfig.getSocketTimeout()

烈酒焚心 提交于 2019-12-23 07:56:09

问题


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

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

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

I can also use

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

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

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


回答1:


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.



来源:https://stackoverflow.com/questions/22716086/apache-httpclient-4-3-socketconfig-getsotimeout-vs-requestconfig-getsockettime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!