You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "McMahon, Joseph" <jm...@redsiren.com> on 2004/03/03 14:41:54 UTC

Timeout exception

I have a client program that uses the MultiThreadedHttpConnectionManager and
after a while, it seems like the connections "hang".  I haven't traced
anything yet to know the wire state of the connection, but as I read through
the archives here, I saw that people use the setTimeout to create a timeout
on reading data.  Does this cause an exception to be thrown or a specific
return value from the <method>.execute() method?? 

 

Thanks,

Joe

 


Re: HttpClient and Concurrent requests to the same host.

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Yep, thats the solution. Thanks a bunch.

Michael Becke wrote:

> Hi Mark,
> 
> By default HttpClient makes use of the SimpleHttpConnectionManager. This 
> connection manager only supports one request at a time.  Each request, 
> including the response, must be fully complete before the next begins.  
> Sounds like the MultiThreadedHttpConnectionManager might be more 
> appropriate for you 
> <http://jakarta.apache.org/commons/httpclient/threading.html>.
> 
> Mike
> 
> Mark R. Diggory wrote:
> 
>> I have an instance of HttpClient which I think I'm experiencing a race 
>> condition with.
>>
>> I make one GetMethod request to a resource, as I'm parsing the 
>> InputStream into xml, I'm also making secondary GetMethod requests to 
>> URI's that reside on the same host. During each secondary request, I 
>> properly close the InputStream and call method.releaseConnection() to 
>> return the connection to the pool.
>>
>> Unfortunately, calling these methods seems to also close down the 
>> initial parent stream which should still contain content and be 
>> readable after the secondary connection is closed.
>>
>> Should I be using the multithreaded HostConfiguration here?
>>
>> -Mark
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
> 

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: HttpClient and Concurrent requests to the same host.

Posted by Michael Becke <be...@u.washington.edu>.
Hi Mark,

By default HttpClient makes use of the SimpleHttpConnectionManager. 
This connection manager only supports one request at a time.  Each 
request, including the response, must be fully complete before the next 
begins.  Sounds like the MultiThreadedHttpConnectionManager might be 
more appropriate for you 
<http://jakarta.apache.org/commons/httpclient/threading.html>.

Mike

Mark R. Diggory wrote:
> I have an instance of HttpClient which I think I'm experiencing a race 
> condition with.
> 
> I make one GetMethod request to a resource, as I'm parsing the 
> InputStream into xml, I'm also making secondary GetMethod requests to 
> URI's that reside on the same host. During each secondary request, I 
> properly close the InputStream and call method.releaseConnection() to 
> return the connection to the pool.
> 
> Unfortunately, calling these methods seems to also close down the 
> initial parent stream which should still contain content and be readable 
> after the secondary connection is closed.
> 
> Should I be using the multithreaded HostConfiguration here?
> 
> -Mark
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


HttpClient and Concurrent requests to the same host.

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I have an instance of HttpClient which I think I'm experiencing a race 
condition with.

I make one GetMethod request to a resource, as I'm parsing the 
InputStream into xml, I'm also making secondary GetMethod requests to 
URI's that reside on the same host. During each secondary request, I 
properly close the InputStream and call method.releaseConnection() to 
return the connection to the pool.

Unfortunately, calling these methods seems to also close down the 
initial parent stream which should still contain content and be readable 
after the secondary connection is closed.

Should I be using the multithreaded HostConfiguration here?

-Mark

-- 
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Re: Timeout exception

Posted by Michael Becke <be...@u.washington.edu>.
Hi Joe,

Read timeouts will cause exceptions to be thrown from within 
HttpMethod.execute().

Mike

McMahon, Joseph wrote:

> I have a client program that uses the MultiThreadedHttpConnectionManager and
> after a while, it seems like the connections "hang".  I haven't traced
> anything yet to know the wire state of the connection, but as I read through
> the archives here, I saw that people use the setTimeout to create a timeout
> on reading data.  Does this cause an exception to be thrown or a specific
> return value from the <method>.execute() method?? 
> 
>  
> 
> Thanks,
> 
> Joe
> 
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org