timoninmaxim commented on a change in pull request #8206:
URL: https://github.com/apache/ignite/pull/8206#discussion_r505255089



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java
##########
@@ -223,67 +203,78 @@
     ) throws ClientException, ClientError {
         CompletableFuture<T> fut = new CompletableFuture<>();
 
-        ClientChannel ch = channel();
-
-        ch.serviceAsync(op, payloadWriter, payloadReader).handle((res, err) ->
-                handleServiceAsync(op, payloadWriter, payloadReader, fut, 
null, null, ch, res, err));
+        // Use the only one attempt to avoid blocking async method.
+        handleServiceAsync(fut, op, payloadWriter, payloadReader, 1, null);
 
         return new IgniteClientFutureImpl<>(fut);
     }
 
     /**
      * Handles serviceAsync results and retries as needed.
      */
-    private <T> Object handleServiceAsync(ClientOperation op,
-                                          Consumer<PayloadOutputChannel> 
payloadWriter,
-                                          Function<PayloadInputChannel, T> 
payloadReader,
-                                          CompletableFuture<T> fut,
-                                          ClientConnectionException failure,
-                                          AtomicInteger chIdx,
-                                          ClientChannel ch,
-                                          T res,
-                                          Throwable err) {
-        if (err == null) {
-            fut.complete(res);
-            return null;
+    private <T> void handleServiceAsync(final CompletableFuture<T> fut,
+                                        ClientOperation op,
+                                        Consumer<PayloadOutputChannel> 
payloadWriter,
+                                        Function<PayloadInputChannel, T> 
payloadReader,
+                                        int attemptsLimit,
+                                        ClientConnectionException failure) {
+        T2<ClientChannel, Integer> chAndAttempts;
+
+        try {
+            chAndAttempts = applyOnDefaultChannel(channel -> channel, 
attemptsLimit);
+
+        } catch (Throwable ex) {
+            fut.completeExceptionally(ex);

Review comment:
       fixed




----------------------------------------------------------------
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.

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


Reply via email to