Hi.

I’m writing an OAI harvester (it’s an obscure protocol you’ve probably never 
heard of for the exchange of metadata with content repositories). The 
implementation guidelines mention 503 handling: 
http://www.openarchives.org/OAI/2.0/guidelines-harvester.htm#FlowControl 
<http://www.openarchives.org/OAI/2.0/guidelines-harvester.htm#FlowControl>. In 
particular, the suggestion is to respect the Retry-After header if present.

When last I did this, I had to implement it myself, but I see that HttpClient 4 
has 503 handling built in.

http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/ServiceUnavailableRetryStrategy.html
 
<http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/ServiceUnavailableRetryStrategy.html>

But I’m not sure how to use this if the retry interval should vary 
per-response. getRetryInterval takes no arguments, and in particular has no 
access to the HttpResponse, so I’m not sure how I could go about using this. I 
had considered storing something when the call to retryRequest is made, but I’m 
not sure this is safe to do (it seems likely that it is not, since the strategy 
is almost certainly shared among multiple threads). It also seems kind of 
kludgy to me. Is there a way to do this cleanly? If not, is there a thread safe 
way to keep this state around between calls to the two methods?

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to