You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Joan Balagueró Valls <jo...@ventusproxy.com> on 2009/06/05 11:59:59 UTC
TUTORIAL AND ABORT METHOD
Hello Oleg,
Ive read the tutorial, and its OK for me.
Just one question (important, I think) about connection release. Ive
compared what your tutorial says about this, and the web.
In H4 website, one can see the following:
// In case of an IOException the connection will be released
// back to the connection manager automatically
But your tutorial says that always we get an exception, we should call the
abort method, but the abort method does not return the connection to the
pool.
Then, it seems that the procedure should be:
1. If the request/response process finished OK (consuming the content)
--> do nothing (HTTP releases the connection automatically)
2. If an IOException occurs --> do nothing (HTTP releases the
connection automatically)
3. If another exception occurs, call abort method.
Is this OK?
Thanks,
Joan.
Re: TUTORIAL AND ABORT METHOD
Posted by Oleg Kalnichevski <ol...@apache.org>.
Joan Balagueró Valls wrote:
> Hello Oleg,
>
>
>
> I’ve read the tutorial, and it’s OK for me.
>
>
>
> Just one question (important, I think) about connection release. I’ve
> compared what your tutorial says about this, and the web.
>
>
>
> In H4 website, one can see the following:
>
> // In case of an IOException the connection will be released
> // back to the connection manager automatically
>
>
>
> But your tutorial says that always we get an exception, we should call the
> abort method, but the abort method does not return the connection to the
> pool.
>
>
>
> Then, it seems that the procedure should be:
>
>
>
> 1. If the request/response process finished OK (consuming the content)
> --> do nothing (HTTP releases the connection automatically)
> 2. If an IOException occurs --> do nothing (HTTP releases the
> connection automatically)
> 3. If another exception occurs, call abort method.
>
>
>
> Is this OK?
>
This is ok.
It is all very simple. The underlying connection is released
automatically as soon as the end of stream is detected or if IOException
is thrown. If for whatever reason the content cannot be read to the end
of stream, HttpUriRequest#abort must be called.
Hope this helps
Oleg
>
>
> Thanks,
>
>
>
> Joan.
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org