accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [accumulo] hkeebler opened a new pull request #1199: Fix #1122 Added concurrent structures to ThriftTransportPool
Date Mon, 01 Jul 2019 19:00:07 GMT
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<CachedConnection> 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<Entry<ThriftTransportKey,Long>> iter = pool.errorTime.entrySet().iterator();
            while (iter.hasNext()) {
              Entry<ThriftTransportKey,Long> 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

Mime
View raw message