archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1373648 - /archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java
Date Wed, 15 Aug 2012 21:56:05 GMT
Author: olamy
Date: Wed Aug 15 21:56:05 2012
New Revision: 1373648

URL: http://svn.apache.org/viewvc?rev=1373648&view=rev
Log:
use synchronized block only when data are not in the cache

Modified:
    archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java

Modified: archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java?rev=1373648&r1=1373647&r2=1373648&view=diff
==============================================================================
--- archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java
(original)
+++ archiva/redback/redback-core/trunk/redback-rbac/redback-rbac-providers/redback-rbac-cached/src/main/java/org/apache/archiva/redback/rbac/cached/CachedRbacManager.java
Wed Aug 15 21:56:05 2012
@@ -207,7 +207,7 @@ public class CachedRbacManager
      * @see org.apache.archiva.redback.rbac.RBACManager#getAssignedPermissionMap(java.lang.String)
      */
     @SuppressWarnings( "unchecked" )
-    public synchronized Map<String, List<Permission>> getAssignedPermissionMap(
String principal )
+    public Map<String, List<Permission>> getAssignedPermissionMap( String principal
)
         throws RbacObjectNotFoundException, RbacManagerException
     {
         Map<String, List<Permission>> el = (Map<String, List<Permission>>)
userPermissionsCache.get( principal );
@@ -217,13 +217,14 @@ public class CachedRbacManager
             log.debug( "using cached user permission map" );
             return el;
         }
-        else
+        synchronized ( userPermissionsCache )
         {
             log.debug( "building user permission map" );
             Map<String, List<Permission>> userPermMap = this.rbacImpl.getAssignedPermissionMap(
principal );
             userPermissionsCache.put( principal, userPermMap );
             return userPermMap;
         }
+
     }
 
     public Set<Permission> getAssignedPermissions( String principal )



Mime
View raw message