yifan-c commented on code in PR #61:
URL: https://github.com/apache/cassandra-sidecar/pull/61#discussion_r1262834808


##########
client/src/main/java/org/apache/cassandra/sidecar/client/RequestExecutor.java:
##########
@@ -142,62 +160,6 @@ public void close() throws Exception
         httpClient.close();
     }
 
-    /**
-     * Executes the request from the {@code context}, it iterates over the 
{@link SidecarInstance}s until the response
-     * satisfies the {@code retryPolicy}.
-     *
-     * @param future    a future for the {@link HttpResponse}
-     * @param iterator  the iterator of instances
-     * @param context   the request context
-     * @param attempt   the number of attempts for this request
-     * @param throwable the last {@link Throwable}, or {@code null} if there 
are no previous errors
-     */
-    protected void executeWithRetries(CompletableFuture<HttpResponse> future,
-                                      Iterator<SidecarInstance> iterator,
-                                      RequestContext context,
-                                      int attempt,
-                                      Throwable throwable)
-    {
-        if (iterator.hasNext())
-        {
-            executeWithRetries(future, iterator, iterator.next(), context, 
attempt);
-        }
-        else
-        {
-            // exhausted retries on all available hosts
-            future.completeExceptionally(new 
RetriesExhaustedException(attempt, context.request(), throwable));
-        }
-    }

Review Comment:
   reviewer note: I found this method being redundant. It is only called when 
`iterator.hasNext()` is true, since the condition has been checked on the only 
call-site. The else branch is never hit. Then, the method has the same effect 
as its overload. Therefore, I am removing this method and the similar one for 
stream, for code simplicity. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to