You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2005/06/29 19:47:31 UTC

svn commit: r202406 - /portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java

Author: taylor
Date: Wed Jun 29 10:47:31 2005
New Revision: 202406

URL: http://svn.apache.org/viewcvs?rev=202406&view=rev
Log:
optimize anonymous user excessive database i/o as it was causing 8-10 db accesses per requests during wget simulated user tests

Modified:
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java

Modified: portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java?rev=202406&r1=202405&r2=202406&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java (original)
+++ portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/impl/UserManagerImpl.java Wed Jun 29 10:47:31 2005
@@ -59,7 +59,8 @@
     private SecurityMappingHandler securityMappingHandler = null;
 
     private String anonymousUser = "guest";
-
+    private User guest = null;
+    
     /**
      * @param securityProvider
      *            The security provider.
@@ -322,6 +323,13 @@
         { username}, new String[]
         { "username"}, "getUser(java.lang.String)");
 
+        // optimize guest lookups as they can be excessive
+        if (guest != null && getAnonymousUser().equals(username))
+        {
+            // TODO: need to handle caching issues            
+            return guest;
+        }
+        
         Set principals = new HashSet();
         String fullPath = (new UserPrincipalImpl(username)).getFullPath();
 
@@ -347,7 +355,10 @@
         }
         Preferences preferences = Preferences.userRoot().node(fullPath);
         User user = new UserImpl(subject, preferences);
-
+        if (getAnonymousUser().equals(username))
+        {
+            guest = user;
+        }
         return user;
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org