hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: HttpClient and Threads
Date Mon, 13 Oct 2008 09:29:48 GMT
On Fri, 2008-10-10 at 14:22 -0400, AP Adam Patt (5094) wrote:
> > Essentially you _assume_ HttpClient is the culprit, rather
> > synchronization logic in your code, don't you?
> > 
> > To see what exactly what is happening inside HttpClient 
> > components, run
> > it with both wire and context logging on. You should also use 
> > a logging
> > toolkit that can provide you with the thread context information (such
> > as Log4j), since this problem appears to be threading related. If you
> > need help interpreting the logs feel free to post them to this list. 
> When I was using the built in HttpURLConnection I could clearly see that
> multiple threads were actually working at the same time.  The only
> change I made was to use the HttpClient library in place of the
> HttpURLConnection library and I found this problem.
> Just to be sure that there wasn't something else causing things to act
> this way, I put a sleep that adjusted based on the size of the file in
> place of where the executeMethod and getResponseBodyAsStream calls go.
> When I use the sleep, I clearly see that 4 threads are working and
> completing at different times relative to the size of the file.  When I
> add the code back to actually make the network call, it goes back to
> putting one request after another.
> I wish I could give you a working version of the program, but it depends
> on internal server side stuff to work correctly.  I was hoping that I
> was making a call incorrectly, but it seems like something stranger is
> going on.  I need to actually switch and work on something else right
> now but would like to create a simple program that can show this problem
> clearly without the other dependencies.  Maybe I can do that next week
> and post it.
> When do you mean by context logging?  Is there something in the
> HttpClient library that I should enable to see what is going on?  And
> are you referring to a packet tracking tool like Wireshark for wire
> logging, or is that another HttpClient option that I should turn on?

Please refer to the instructions given in the HttpClient logging guide:


This should give you enough details about request execution and the
internal state of HttpClient.


> I have a debug window that I write log messages to that basically acts
> as my log to see what is going on and I have message give me thread
> information in there when it's relevant.
> Thanks much for the responses.  Even though I haven't gotten the problem
> solved, I feel I am making some progress.  If you have any other
> suggestions I would love to hear them, otherwise I will try and work on
> a sample program that I can actually post to demonstrate my problem.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org

To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message