Session manager performance
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 16 Nov 2010 18:07:56 +0000 (18:07 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 16 Nov 2010 18:07:56 +0000 (18:07 +0000)
Move sync. No performance change but sync requirements for sub-classes are clearer.
Still looking to remove sync completely.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1035720 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/session/ManagerBase.java

index d9fc7a5..f6c35ec 100644 (file)
@@ -959,7 +959,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase
     }
 
 
-    protected void getRandomBytes(byte bytes[]) {
+    protected synchronized void getRandomBytes(byte bytes[]) {
         // Generate a byte array containing a session identifier
         if (devRandomSourceIsValid && randomIS == null) {
             setRandomFile(devRandomSource);
@@ -1008,9 +1008,7 @@ public abstract class ManagerBase extends LifecycleMBeanBase
             }
 
             while (resultLenBytes < this.sessionIdLength) {
-                synchronized (this) {
-                    getRandomBytes(random);
-                }
+                getRandomBytes(random);
                 MessageDigest md = digests.poll();
                 if (md == null) {
                     // If this fails, NPEs will follow. This should never fail