Brice Ruth <bdruth <at> gmail.com> writes:
> In researching this in the past, I found that there's a "problem" with just
setting the SoTimeout when the connection uses HTTP/1.1, because of something
called "Expect: 100-Continue" - apparently this has something to do with keep-
alive, and it totally hoses timeouts. So, when you're setting up your
HttpClientParams, you need to either disable 100-Continue, or switch to
HTTP/1.0. Either of these should make your timeout work as expected.
> HttpClientParams.USE_EXPECT_CONTINUE (false)setVersion(HttpVersion.HTTP_1_0)
either of these should do the trick.Cheers,Brice
Thanks for the suggestion. I gave that a try (w/both), and still the
connection manager returns a connection with timeout set to 0/disabled. Not
sure if my changes to httpClientParams are actually being seen where they
should be. Here's the whole line of code:
Service serviceModel = new ObjectServiceFactory().create
(TesterWebService.class);
TesterWebService testerService = (TesterWebService) new XFireProxyFactory
().create(serviceModel, args[0]);
Client client = Client.getInstance(testerService);
...
int timeoutMs = client.getTimeout();
client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, Integer.toString
((timeoutMs/1000)));
HttpClientParams httpClientParams = new HttpClientParams();
httpClientParams.setConnectionManagerTimeout(timeoutMs);
httpClientParams.setSoTimeout(timeoutMs);
httpClientParams.setBooleanParameter(HttpClientParams.USE_EXPECT_CONTINUE,
false);
httpClientParams.setVersion(HttpVersion.HTTP_1_0);
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS,
httpClientParams);
logger.debug("doSleep: " + testerService.doSleep(timeoutMs *2));
logging still shows:
3219 [main] DEBUG
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager:getConnectionW
ithTimeout:390 - HttpConnectionManager.getConnection: config =
HostConfiguration[host=http://xxx.xxx.xxx.xxx:7003], timeout = 0
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email