Sean Landis <sean.landis <at> gmail.com> writes:

> 
> I am using the new apache http client and I'm seeing strange behavior. I am
> sending 50 messages to the server in rapid succession. Using the 'ethereal' 
> tool, I examined the TCP traffic. What I saw was that occasionally the 
> connection would get reused once, that is, two calls would occur before the
> connection was closed. In the other cases, I think 45, the connection was 
> closed after the first call.

I figured out my problem. I was reviewing a link Jerome had referred me to,
http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html
and saw this:

"Do not abandon a connection by ignoring the response body. Doing so may 
results 
in idle TCP connections. That needs to be garbage collected when they are no
longer referenced."

I added: 

tmp = reply.getOutput();

and connections remained open.

Sean

Reply via email to