ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] alex-plekhanov commented on a change in pull request #6595: IGNITE-11685 Java thin client: Handle multiple async requests in parallel
Date Mon, 08 Jul 2019 07:58:31 GMT
alex-plekhanov commented on a change in pull request #6595: IGNITE-11685 Java thin client:
Handle multiple async requests in parallel
URL: https://github.com/apache/ignite/pull/6595#discussion_r300965058
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/client/thin/ReliableChannel.java
 ##########
 @@ -114,76 +118,51 @@
     }
 
     /**
-     * Send request and handle response. The method is synchronous and single-threaded.
+     * Send request and handle response.
      */
     public <T> T service(
         ClientOperation op,
-        Consumer<BinaryOutputStream> payloadWriter,
-        Function<BinaryInputStream, T> payloadReader
+        Consumer<PayloadOutputChannel> payloadWriter,
+        Function<PayloadInputChannel, T> payloadReader
     ) throws ClientException {
         ClientConnectionException failure = null;
 
-        T res = null;
-
-        int totalSrvs = 1 + backups.size();
-
-        svcLock.lock();
-        try {
-            for (int i = 0; i < totalSrvs; i++) {
-                try {
-                    if (ch == null)
-                        ch = chFactory.apply(new ClientChannelConfiguration(clientCfg).setAddress(primary)).get();
-
-                    long id = ch.send(op, payloadWriter);
-
-                    res = ch.receive(op, id, payloadReader);
+        for (int i = 0; i < srvCnt; i++) {
+            ClientChannel ch = null;
 
-                    failure = null;
+            try {
+                ch = channel();
 
-                    break;
-                }
-                catch (ClientConnectionException e) {
-                    if (failure == null)
-                        failure = e;
-                    else
-                        failure.addSuppressed(e);
+                return ch.service(op, payloadWriter, payloadReader);
+            }
+            catch (ClientConnectionException e) {
+                if (failure == null)
+                    failure = e;
+                else
+                    failure.addSuppressed(e);
 
-                    changeServer();
-                }
+                changeServer(ch);
 
 Review comment:
   Yes, such case is possible. I've made another fix to handle this.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message