jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsedd...@apache.org
Subject svn commit: r1740814 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.java
Date Mon, 25 Apr 2016 11:35:04 GMT
Author: jsedding
Date: Mon Apr 25 11:35:04 2016
New Revision: 1740814

URL: http://svn.apache.org/viewvc?rev=1740814&view=rev
Log:
JCR-3971 - Make read-permission cache-size in CompiledPermissionsImpl configurable

- original patch by Manfred Baedke

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/CompiledPermissionsImpl.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=1740814&r1=1740813&r2=1740814&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
Mon Apr 25 11:35:04 2016
@@ -36,6 +36,8 @@ import org.apache.jackrabbit.core.securi
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.util.Text;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
@@ -51,6 +53,15 @@ import java.util.Set;
  */
 class CompiledPermissionsImpl extends AbstractCompiledPermissions implements AccessControlListener
{
 
+    private static final Logger LOG = LoggerFactory.getLogger(CompiledPermissionsImpl.class);
+
+    public static final int DEFAULT_MAX_CACHE_SIZE = 5000;
+
+    public static final int MAX_CACHE_SIZE = Integer.getInteger(
+            "org.apache.jackrabbit.core.security.authorization.acl.CompiledPermissionsImpl.cacheSize",
+            DEFAULT_MAX_CACHE_SIZE
+    );
+
     private final List<String> principalNames;
     private final SessionImpl session;
     private final EntryCollector entryCollector;
@@ -61,7 +72,7 @@ class CompiledPermissionsImpl extends Ab
      * removing LRU items.
      */
     @SuppressWarnings("unchecked")
-    private final Map<ItemId, Boolean> readCache = new GrowingLRUMap(1024, 5000);
+    private final Map<ItemId, Boolean> readCache = new GrowingLRUMap(1024, MAX_CACHE_SIZE);
 
     private final Object monitor = new Object();
 
@@ -84,6 +95,8 @@ class CompiledPermissionsImpl extends Ab
             */
             entryCollector.addListener(this);
         }
+
+        LOG.debug("Read permission cache size = {}", MAX_CACHE_SIZE);
     }
 
     private Result buildResult(NodeImpl node, boolean isExistingNode,



Mime
View raw message