バックオフ再試行メカニズムを使用して、http 要求のリストを送信したいと考えています。
再試行後にのみ成功したリクエストを (フラグで) マークする方法はありますか?
私はいくつかの解決策を見ました:
1) https://github.com/rholder/guava-retrying
2) https://developers.google.com/api-client-library/java/google-http-java-client/backoff
しかし、このフラグを統合する方法はありませんでした。これらのライブラリに他のライブラリやアイデアはありますか?
このメソッドをオーバーライドしようとしましたが、その指示フラグを返す方法がありません
@Beta
public class HttpBackOffUnsuccessfulResponseHandler implements HttpUnsuccessfulResponseHandler {
* {@inheritDoc}
*
* <p>
* Handles the request with {@link BackOff}. That means that if back-off is required a call to
* {@link Sleeper#sleep(long)} will be made.
* </p>
*/
public final boolean handleResponse(
HttpRequest request, HttpResponse response, boolean supportsRetry) throws IOException {
if (!supportsRetry) {
return false;
}
// check if back-off is required for this response
if (backOffRequired.isRequired(response)) {
try {
return BackOffUtils.next(sleeper, backOff);
} catch (InterruptedException exception) {
// ignore
}
}
return false;
}