From notifications-return-50809-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Mon Jul 1 19:00:08 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 15A09180670 for ; Mon, 1 Jul 2019 21:00:07 +0200 (CEST) Received: (qmail 65987 invoked by uid 500); 1 Jul 2019 19:00:07 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 65976 invoked by uid 99); 1 Jul 2019 19:00:07 -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, 01 Jul 2019 19:00:07 +0000 From: GitBox To: notifications@accumulo.apache.org Subject: [GitHub] [accumulo] hkeebler opened a new pull request #1199: Fix #1122 Added concurrent structures to ThriftTransportPool Message-ID: <156200760722.13019.12567754436577871777.gitbox@gitbox.apache.org> Date: Mon, 01 Jul 2019 19:00:07 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit hkeebler opened a new pull request #1199: Fix #1122 Added concurrent structures to ThriftTransportPool URL: https://github.com/apache/accumulo/pull/1199 Also contains suggestions for removing syncrhonized blocks. (previous pull request was closed because wron branch was pushed) Syncrhronized blocks of text are commented out with "NOT NEEDED?" in the diffs below. These may not be necessary if the object constructs handle write/delete concurrency. But maybe they are not that costly. Additionally - I have a question on the section of code below. The connections are closed specifically after the sync block. It seems that since the "unreserved" is read and not deleted from then someone could use one that is designated to close by the sync blck. ```java synchronized (pool) { for (CachedConnections cachedConns : pool.getCache().values()) { Iterator iter = cachedConns.unreserved.iterator(); while (iter.hasNext()) { CachedConnection cachedConnection = iter.next(); if (System.currentTimeMillis() - cachedConnection.lastReturnTime > pool.killTime) { connectionsToClose.add(cachedConnection); iter.remove(); } } for (CachedConnection cachedConnection : cachedConns.reserved.values()) { cachedConnection.transport.checkForStuckIO(STUCK_THRESHOLD); } } Iterator> iter = pool.errorTime.entrySet().iterator(); while (iter.hasNext()) { Entry entry = iter.next(); long delta = System.currentTimeMillis() - entry.getValue(); if (delta >= STUCK_THRESHOLD) { pool.errorCount.remove(entry.getKey()); iter.remove(); } } } // close connections outside of sync block for (CachedConnection cachedConnection : connectionsToClose) { cachedConnection.transport.close(); } ``` ---------------------------------------------------------------- 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