mikewalch commented on a change in pull request #383: ACCUMULO-4809 Avoid 
blocking during session cleanup
URL: https://github.com/apache/accumulo/pull/383#discussion_r168228686
 
 

 ##########
 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:
   why do you have a synchronized block on `idleSessions` with the other blocks 
removed?  Is this to prevent multiple interleaving calls to sweep?

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

Reply via email to