timoninmaxim commented on code in PR #11660:
URL: https://github.com/apache/ignite/pull/11660#discussion_r1850298040


##########
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java:
##########
@@ -817,7 +818,10 @@ private <T> T applyOnDefaultChannel(
         ClientOperation op,
         @Nullable List<ClientConnectionException> failures
     ) {
-        while (attemptsLimit > (failures == null ? 0 : failures.size())) {
+        int fixedAttemptsLimit = attemptsLimit;
+
+        // + 1 is only required if the failure list is empty/null
+        while (fixedAttemptsLimit + 1 > (failures == null ? 0 : 
failures.size())) {

Review Comment:
   Move +1 to var assignment.



##########
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java:
##########
@@ -703,7 +703,8 @@ synchronized void initChannelHolders() {
                     curAddrs.putIfAbsent(addr, hld);
             }
 
-            reinitHolders.add(hld);
+            if (!reinitHolders.contains(hld))

Review Comment:
   In most cases `ArrayList#contains` will traverse whole collection just to 
find that no such holder. Let's make the check more optimal. 



##########
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java:
##########
@@ -817,7 +818,10 @@ private <T> T applyOnDefaultChannel(
         ClientOperation op,
         @Nullable List<ClientConnectionException> failures
     ) {
-        while (attemptsLimit > (failures == null ? 0 : failures.size())) {
+        int fixedAttemptsLimit = attemptsLimit;
+
+        // + 1 is only required if the failure list is empty/null

Review Comment:
   No valid comment.



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to