On Tue, 2010-03-23 at 14:31 +0100, Joan Balaguero wrote: > Hello, > > > > We're querying a webservice using a 'ThreadSafeClientConnManager'. > > Platform: windows 2003 Server 64bit > > httpClient 4.0 > > jre 6 update 13 on Tomcat 6.0.18 > > > > We're setting a global response timeout with: > > HttpParams objHttpParams = new BasicHttpParams(); > > HttpProtocolParams.setVersion(objHttpParams, HttpVersion.HTTP_1_1); > > HttpConnectionParams.setSoTimeout(objHttpParams, responseTimeout); > > ClientConnectionManager cm = new ThreadSafeClientConnManager(objHttpParams, > HttpUtils.createDefaultSchemeRegistry()); > > this.objHttp = new DefaultHttpClient(cm, objHttpParams); > > > > For every webservice call, if the response timeout (at call level) is > greater than 0 then: > > if (objCall.responseTimeout != 0) > objPost.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, > objCall.responseTimeout); > > > > Then we send the request: > > StringEntity entity = new StringEntity(request.createRequestParameters()); > > entity.setContentType(request.contentType); > > objPost.setEntity(entity); > > > > return (this.objHttp.execute(objPost)); > > > > And we read the response: > > bis = new BufferedInputStream(entity.getContent()); > > ByteArrayOutputStream buffer = new ByteArrayOutputStream(httpOutBufferSize); > > byte[] tmp = new byte[httpOutBufferSize]; > > int numBytesRead = 0; > > > > while ((numBytesRead = bis.read(tmp)) >= 0) buffer.write(tmp, 0, > numBytesRead); > > bis.close(); > > bis = null; > > > > > > Performing a thread dump, we can see many threads blocked waiting a response > several minutes (2,3,4 minutes) when the maximum response timeout is 60 > seconds (at webservice and call level). >
Please see definition of the socket timeout Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
