Hi,
I'm using HttpClient 3.1 to connect to a server.
I've set both the connection timeout and the socket timeout.
I set the connection timeout in the HttpConnectionManager (later set
in HttpClient) like this:
------------
MultiThreadedHttpConnectionManager cm = new
MultiThreadedHttpConnectionManager();
//connection timeout - same value as for socket timeout (set in
the PostMethod - see below))
cm.getParams().setConnectionTimeout(Integer.parseInt(getProperty
(MADS_AD_TIMEOUT)));
//set HttpConnectionManager in HttpClient
madsClient.setHttpConnectionManager(cm);
------------
I set the sockettimeout in the PostMethod class like this:
------------
//retry and socket timeout settings (result = an instance of
PostMethod)
result.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(1, false));
//socket timeout (connection timeout already set in
HttpClient)
result.getParams().setSoTimeout(Integer.parseInt(getProperty
(MADS_AD_TIMEOUT)));
-------------
At times (when the server we connect to is slow on response?) the
requests still wait for a much longer time than the timeout we use
(500 ms).
A SocketTimeout/ConnectionTimeout-exception is thrown, but this might
take a very long time (48 seconds is a recent example). We measure
the time in
our code.
Any idea what might cause this problem?
/best regards, HÃ¥kan Jacobsson, System developer in Stockholm, Sweden.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]