Create a new RequestConfig:
RequestConfig defaultRequestConfig = RequestConfig.custom()
.setSocketTimeout(5000)
.setConnectTimeout(5000)
.setConnectionRequestTimeout(5000)
.setStaleConnectionCheckEnabled(true)
.build();
This timeout can be set to the client level as the default for all requests:
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultRequestConfig(defaultRequestConfig)
.build();
Request does not inherit the client-level request configuration, so when customizing the Request, you need to copy the client's default configuration:
HttpGet httpget = new HttpGet("http://www.apache.org/");
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
.setProxy(new HttpHost("myotherproxy", 8080))
.build();
httpget.setConfig(requestConfig);
Reprinted toOkidoGreen
The article is a memo, do not like to spray, welcome the proposal, thank you.
Original address:https://gist.github.com/montanaflynn/ef9e7b9cd21b355cfe8332b4f20163c1(need to overturn the wall)...
source:...
Configure in app.json...
The system default timeout period is 180000 milliseconds (30 minutes) You can set a custom timeout time in the following 2 ways One: Configuration file Two: through api Shiro's Session interface has a...
RestTemplate is set for timeout, causing a large amount of Rabbitmq queue, consumers, do not consume, similar thread blockage. Check: From a log quest issue, the business service will be called from e...
Add the following code to httpd.conf Modify max_execution_time configuration parameters in php.ini Then restart Apache and PHP....
Java config mode Profile specification Designation doc Spring RestTemplate timeout...
sequence The timeout setting of the ribbon can only be divided according to the forwarded serviceId. It is not possible to set the timeout directly in each forwarded link like nginx. Here hack, implem...