protected void executeWithRetries()

in client/src/main/java/org/apache/cassandra/sidecar/client/RequestExecutor.java [173:201]


    protected void executeWithRetries(CompletableFuture<HttpResponse> future,
                                      Iterator<SidecarInstance> iterator,
                                      SidecarInstance sidecarInstance,
                                      RequestContext context,
                                      int attempt)
    {
        logger.debug("Request from instance={}, request={}, attempt={}",
                     sidecarInstance, context.request(), attempt);

        // execute the http request and process the response with the retry policy
        try
        {
            httpClient.execute(sidecarInstance, context)
                      .whenComplete((HttpResponse response, Throwable throwable) ->
                                    applyRetryPolicy(future,
                                                     iterator,
                                                     sidecarInstance,
                                                     context,
                                                     attempt,
                                                     response,
                                                     throwable));
        }
        catch (Throwable throwable)
        {
            logger.error("Unexpected error while executing the request. instance={}, request={}, attempt={}",
                         sidecarInstance, context.request(), attempt);
            future.completeExceptionally(throwable);
        }
    }