Author: kkolinko
Date: Mon Dec 21 13:31:46 2009
New Revision: 892817

URL: http://svn.apache.org/viewvc?rev=892817&view=rev
Log:
Second followup to r892341
Small improvements, based on sebb's and my comments.

Modified:
    tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java

Modified: 
tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java?rev=892817&r1=892816&r2=892817&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/PersistentManagerBase.java 
Mon Dec 21 13:31:46 2009
@@ -213,7 +213,7 @@
     /**
      * Sessions currently being swapped in and the associated locks
      */
-    private Map<String,Object> sessionSwapInLocks =
+    private final Map<String,Object> sessionSwapInLocks =
        new HashMap<String,Object>();
 
 
@@ -794,15 +794,14 @@
         /*
          * The purpose of this sync and these locks is to make sure that a
          * session is only loaded once. It doesn't matter if the lock is 
removed
-         * and then another thread enters this method and trues to load the 
same
-         * session. That thread will re-creates a swapIn lock for that session,
+         * and then another thread enters this method and tries to load the 
same
+         * session. That thread will re-create a swapIn lock for that session,
          * quickly find that the session is already in sessions, use it and
          * carry on.
          */
         synchronized (this) {
-            if (sessionSwapInLocks.containsKey(id)) {
-                swapInLock = sessionSwapInLocks.get(id);
-            } else {
+            swapInLock = sessionSwapInLocks.get(id);
+            if (swapInLock == null) {
                 swapInLock = new Object();
                 sessionSwapInLocks.put(id, swapInLock);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to