We have a Spring 3 web application on Tomcat 6 that uses several scheduled services via @Scheduled (mainly for jobs that run every night). Now it appears that s
Since this question got so many votes, I'll post what the (probably very specific) solution to my problem was.
We are using the Apache HttpClient library to make calls to remote services in the scheduled jobs. Unfortunately there are no default timeouts set when performing requests. After setting
connectTimeout
connectionRequestTimeout
socketTimeout
to 30 seconds the problem was gone.
int timeout = 30 * 1000; // 30 seconds
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout).build();
HttpClient client = HttpClients.custom()
.setDefaultRequestConfig(requestConfig).build();