views:

107

answers:

1

Hi all, I'm come upon a wierd problem with java HttpClient library. Specifically the library automatically retries my request (POST requests) even before the response is received from the server. Moreover the weirder problem is that this only happens on specific hosts (machines).

So the end result is if a post request succeeds, then there may be an exact same post request coming to the server which the server can't handle. Now, I do want the retry behavior, but it should behave intuitively.
Anyone faced this kind of problem before, or is there a way to configure http client to wait for a specific time before retrying. I'm not sure what going wrong here.

A: 

Do you have a methodretryhandler set for your HttpClient? As in:

DefaultMethodRetryHandler retryhandler = new DefaultMethodRetryHandler(10, true);
client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryhandler);

That is where retries would originate and you could debug and see what response headers it's receiving if any, etc.

Have you tried using a firefox http monitor or ethereal or similar to look through your http requests and responses and ensure that what you believe is happening is actually hapening?