From notifications-return-4167-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Mon Jul 8 07:58:32 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3A112180665 for ; Mon, 8 Jul 2019 09:58:32 +0200 (CEST) Received: (qmail 61552 invoked by uid 500); 8 Jul 2019 07:58:31 -0000 Mailing-List: contact notifications-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list notifications@ignite.apache.org Received: (qmail 61543 invoked by uid 99); 8 Jul 2019 07:58:31 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jul 2019 07:58:31 +0000 From: GitBox To: notifications@ignite.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 Message-ID: <156257271153.8162.11141304881333245577.gitbox@gitbox.apache.org> Date: Mon, 08 Jul 2019 07:58:31 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 service( ClientOperation op, - Consumer payloadWriter, - Function payloadReader + Consumer payloadWriter, + Function 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