You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/09/24 14:37:14 UTC

[GitHub] [accumulo] keith-turner commented on a change in pull request #1374: WIP: Give ThriftTransportPool higher concurrent granularity

keith-turner commented on a change in pull request #1374: WIP: Give ThriftTransportPool higher concurrent granularity
URL: https://github.com/apache/accumulo/pull/1374#discussion_r327623739
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftTransportPool.java
 ##########
 @@ -413,14 +382,20 @@ public TTransport getTransport(HostAndPort location, long milliseconds, ClientCo
   private TTransport getTransport(ThriftTransportKey cacheKey) throws TTransportException {
     // compute hash code outside of lock, this lowers the time the lock is held
     cacheKey.precomputeHashCode();
-    synchronized (this) {
+
+    Lock lock = getLock(cacheKey);
+    lock.lock();
+
+    try {
       // atomically reserve location if it exist in cache
       CachedConnection cachedConnection =
           getCache().computeIfAbsent(cacheKey, ck -> new CachedConnections()).reserveAny();
       if (cachedConnection != null) {
         log.trace("Using existing connection to {}", cacheKey.getServer());
 
 Review comment:
   Ideally logging would not be done while a lock is held as it may do I/O.  This is unrelated to your changes, just something I noticed. I'll open an issue about it later.

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