You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Sergio Berna <sb...@extendnow.com> on 2003/03/27 13:32:06 UTC

doubt about retry

Hello,


I have a small question regarding the HttpException that usually happens
when the connection has been closed previous to re-using it.

In your schema you advise to retry the connection, since a new request is
likely to work. The problem im facing is wheter i can be absolutely sure
that the first request did not reach the server.

For example imagine im performing some sort of request to a remote machine
through http, this request must be unique and cannot be duplicated. Can i be
fully sure that the first request did not reach the server if i get the
recoverable error?

Thanks.

Sergio.

Re: doubt about retry

Posted by Eric Johnson <er...@tibco.com>.
Sergio,

As best I can tell, your stated requirement is one that needs to be 
handled at the server.  Consider:

Your client application --> HttpClient --> JRE --> Client OS --> HTTP 
--> Server OS --> HttpServer --> Server application.
and then:
Your client application <-- HttpClient <-- JRE <-- Client OS <-- HTTP 
<-- Server OS <-- HttpServer <-- Server application.

So far as you know, any one of these "layers" could consume your 
request, or the response, and fail to deliver the "response processed" 
message back to your client.  At least, if you're really being paranoid, 
you need to worry about this.

If you want to insure that the server application processes a request at 
most once, then put a unique number into each request, and the server 
should check that that number does not match any earlier requests.  Of 
course, the server would need to reject any request without a unique number.

It might be possible to approximate your need by a change to 
HttpClient.  Right now, it doesn't guarantee when a recoverable 
exception gets thrown.  It could, for example, be thrown before writing 
the body of any request - in which case you would have your iron-clad 
guarantee that server did not get the request.  That could be a 
sufficient level of protection for what you need.  Is it?

-Eric.

Sergio Berna wrote:

>Hello,
>
>
>I have a small question regarding the HttpException that usually happens
>when the connection has been closed previous to re-using it.
>
>In your schema you advise to retry the connection, since a new request
>is
>likely to work. The problem im facing is wheter i can be absolutely sure
>that the first request did not reach the server.
>
>For example imagine im performing some sort of request to a remote
>machine
>through http, this request must be unique and cannot be duplicated. Can
>i be
>fully sure that the first request did not reach the server if i get the
>recoverable error?
>
>Thanks.
>
>Sergio.
>
>  
>