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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to