keith-turner commented on a change in pull request #383: ACCUMULO-4809 Avoid blocking during session cleanup URL: https://github.com/apache/accumulo/pull/383#discussion_r168271827
########## File path: server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java ########## @@ -169,36 +169,36 @@ public Session removeSession(long sessionId, boolean unreserve) { } private void sweep(final long maxIdle, final long maxUpdateIdle) { - List<Session> sessionsToCleanup = new ArrayList<>(); - synchronized (this) { - Iterator<Session> iter = sessions.values().iterator(); - while (iter.hasNext()) { - Session session = iter.next(); - long configuredIdle = maxIdle; - if (session instanceof UpdateSession) { - configuredIdle = maxUpdateIdle; - } - long idleTime = System.currentTimeMillis() - session.lastAccessTime; - if (idleTime > configuredIdle && !session.reserved) { - log.info("Closing idle session from user=" + session.getUser() + ", client=" + session.client + ", idle=" + idleTime + "ms"); - iter.remove(); - sessionsToCleanup.add(session); + synchronized (idleSessions) { Review comment: > Is this to prevent multiple interleaving calls to sweep? Yeah, that is the purpose. I think in the current code that only one thread will ever call sweep at a time, but I added the sync just to be safe. I will add a comment about this. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services