jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1036450 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization: acl/CompiledPermissionsImpl.java principalbased/ACLProvider.java
Date Thu, 18 Nov 2010 13:27:54 GMT
Author: mduerig
Date: Thu Nov 18 13:27:54 2010
New Revision: 1036450

URL: http://svn.apache.org/viewvc?rev=1036450&view=rev
Log:
JCR-2814 Login performance drop when using DefaultAccessManager
implemented growable LRU for compiled permissions

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ACLProvider.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java?rev=1036450&r1=1036449&r2=1036450&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java
Thu Nov 18 13:27:54 2010
@@ -24,12 +24,7 @@ import org.apache.jackrabbit.core.Sessio
 import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
-import org.apache.jackrabbit.core.security.authorization.AbstractCompiledPermissions;
-import org.apache.jackrabbit.core.security.authorization.AccessControlListener;
-import org.apache.jackrabbit.core.security.authorization.AccessControlModifications;
-import org.apache.jackrabbit.core.security.authorization.AccessControlUtils;
-import org.apache.jackrabbit.core.security.authorization.Permission;
-import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
+import org.apache.jackrabbit.core.security.authorization.*;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.util.Text;
@@ -38,11 +33,7 @@ import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
 import javax.jcr.security.AccessControlEntry;
 import java.security.Principal;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 /**
  * <code>CompiledPermissionsImpl</code>...
@@ -53,8 +44,19 @@ class CompiledPermissionsImpl extends Ab
     private final SessionImpl session;
     private final EntryCollector entryCollector;
     private final AccessControlUtils util;
-    
-    private final Map<ItemId, Boolean> readCache = new LRUMap(5000);
+
+    /*
+     * Start with initial map size of 1024 and grow up to 5000 before
+     * removing LRU items.
+     */
+    @SuppressWarnings("unchecked")
+    private final Map<ItemId, Boolean> readCache = new LRUMap(1024) {
+        @Override
+        protected boolean removeLRU(LinkEntry entry) {
+            return size() > 5000;
+        }
+    };
+
     private final Object monitor = new Object();
 
     CompiledPermissionsImpl(Set<Principal> principals, SessionImpl session,

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ACLProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ACLProvider.java?rev=1036450&r1=1036449&r2=1036450&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ACLProvider.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ACLProvider.java
Thu Nov 18 13:27:54 2010
@@ -306,8 +306,14 @@ public class ACLProvider extends Abstrac
 
         private boolean canReadAll;
 
-        // TODO find optimal cache size and ev. make it configurable (see also JCR-2573).
       
-        private final Map<ItemId, Boolean> readCache = new LRUMap(5000);
+        @SuppressWarnings("unchecked")
+        private final Map<ItemId, Boolean> readCache = new LRUMap(1024) {
+            @Override
+            protected boolean removeLRU(LinkEntry entry) {
+                return size() > 5000;
+            }
+        };
+
         private final Object monitor = new Object();
 
         /**



Mime
View raw message