Is there any way I can mark a tasks that "succeeded only after a retry"?

100 views Asked by At

I want to use a backoff retry mechanism to send a list of http requests.

Is there any way I can mark (with flag) the requests that succeeded only after re-try?

I saw few solutions:

1) https://github.com/rholder/guava-retrying

2) https://developers.google.com/api-client-library/java/google-http-java-client/backoff

but saw no way to integrate this flagging. Any other lib or idea in these libs?

I have tried to override this method, but there is no way to return that indication flag

@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;
  }
0

There are 0 answers