Source:
<code>public void returnTransport(TTransport tsc) { if (tsc == null) { return; } boolean existInCache = false; CachedTTransport ctsc = (CachedTTransport) tsc; ArrayList<CachedConnection> closeList = new ArrayList<>(); CachedConnections cachedConns = getCache().get(ctsc.getCacheKey()); if (cachedConns != null) { CachedConnection cachedConnection = cachedConns.reserved.remove(ctsc); if (cachedConnection != null) { if (ctsc.sawError) { closeList.add(cachedConnection); log.trace("Returned connection had error {}", ctsc.getCacheKey()); Long ecount = errorCount.get(ctsc.getCacheKey()); if (ecount == null) ecount = 0L; ecount++; errorCount.put(ctsc.getCacheKey(), ecount); <START> Long etime = errorTime.get(ctsc.getCacheKey()); <END> if (etime == null) { errorTime.put(ctsc.getCacheKey(), System.currentTimeMillis()); } if (ecount >= ERROR_THRESHOLD && !serversWarnedAbout.contains(ctsc.getCacheKey())) { log.warn("Server had failures in a short time period, will not complain anymore", ctsc.getCacheKey(), ecount); serversWarnedAbout.add(ctsc.getCacheKey()); } cachedConnection.unreserve(); closeList.addAll(cachedConns.unreserved); cachedConns.unreserved.clear(); } else { log.trace("Returned connection ioCount: {}", ctsc.getCacheKey(), cachedConnection.transport.ioCount); cachedConnection.lastReturnTime = System.currentTimeMillis(); cachedConnection.unreserve(); cachedConns.unreserved.push(cachedConnection); } existInCache = true; } } for (CachedConnection cachedConnection : closeList) { try { cachedConnection.transport.close(); } catch (Exception e) { log.debug("Failed to close connection w/ errors", e); } } if (!existInCache) { log.warn("Returned tablet server connection to cache that did not come from cache"); tsc.close(); } }</code><technical_language>able replace this get put java errorTime.computeIfAbsent(ctsc.getCacheKey(), -> System.currentTimeMillis());</technical_language>

Target:
public void returnTransport(TTransport tsc) { if (tsc == null) { return; } boolean existInCache = false; CachedTTransport ctsc = (CachedTTransport) tsc; ArrayList<CachedConnection> closeList = new ArrayList<>(); synchronized (this) { CachedConnections cachedConns = getCache().get(ctsc.getCacheKey()); if (cachedConns != null) { CachedConnection cachedConnection = cachedConns.reserved.remove(ctsc); if (cachedConnection != null) { if (ctsc.sawError) { closeList.add(cachedConnection); log.trace("Returned connection had error {}", ctsc.getCacheKey()); Long ecount = errorCount.merge(ctsc.getCacheKey(), 1L, Long::sum); errorTime.computeIfAbsent(ctsc.getCacheKey(), k -> System.currentTimeMillis()); if (ecount >= ERROR_THRESHOLD && !serversWarnedAbout.add(ctsc.getCacheKey())) { log.warn( "Server had failures in a short time period, will not complain anymore", ctsc.getCacheKey(), ecount); } cachedConnection.unreserve(); closeList.addAll(cachedConns.unreserved); cachedConns.unreserved.clear(); } else { log.trace("Returned connection ioCount: {}", ctsc.getCacheKey(), cachedConnection.transport.ioCount); cachedConnection.lastReturnTime = System.currentTimeMillis(); cachedConnection.unreserve(); cachedConns.unreserved.push(cachedConnection); } existInCache = true; } } } for (CachedConnection cachedConnection : closeList) { try { cachedConnection.transport.close(); } catch (Exception e) { log.debug("Failed to close connection w/ errors", e); } } if (!existInCache) { log.warn("Returned tablet server connection to cache that did not come from cache"); tsc.close(); } }