jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1092106 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/principalbased/ jackrabbit-core/src/main/j...
Date Thu, 14 Apr 2011 10:33:35 GMT
Author: angela
Date: Thu Apr 14 10:33:35 2011
New Revision: 1092106

URL: http://svn.apache.org/viewvc?rev=1092106&view=rev
Log:
JCR-2943 - UserManagement: membership cache default size too small

Added:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
  (with props)
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
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/MembershipCache.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=1092106&r1=1092105&r2=1092106&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 Apr 14 10:33:35 2011
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.core.security.authorization.acl;
 
-import org.apache.commons.collections.map.LRUMap;
 import org.apache.jackrabbit.api.JackrabbitWorkspace;
+import org.apache.jackrabbit.commons.collections.GrowingLRUMap;
 import org.apache.jackrabbit.core.ItemImpl;
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.NodeImpl;
@@ -63,12 +63,7 @@ class CompiledPermissionsImpl extends Ab
      * 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 Map<ItemId, Boolean> readCache = new GrowingLRUMap(1024, 5000);
 
     private final Object monitor = new Object();
 

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=1092106&r1=1092105&r2=1092106&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 Apr 14 10:33:35 2011
@@ -16,9 +16,8 @@
  */
 package org.apache.jackrabbit.core.security.authorization.principalbased;
 
-import org.apache.commons.collections.map.LRUMap;
-import org.apache.jackrabbit.api.JackrabbitWorkspace;
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
+import org.apache.jackrabbit.commons.collections.GrowingLRUMap;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.ItemId;
@@ -313,12 +312,7 @@ public class ACLProvider extends Abstrac
         private boolean canReadAll;
 
         @SuppressWarnings("unchecked")
-        private final Map<ItemId, Boolean> readCache = new LRUMap(1024) {
-            @Override
-            protected boolean removeLRU(LinkEntry entry) {
-                return size() > 5000;
-            }
-        };
+        private final Map<ItemId, Boolean> readCache = new GrowingLRUMap(1024, 5000);
 
         private final Object monitor = new Object();
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/MembershipCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/MembershipCache.java?rev=1092106&r1=1092105&r2=1092106&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/MembershipCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/MembershipCache.java
Thu Apr 14 10:33:35 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.security.user;
 
-import org.apache.commons.collections.map.LRUMap;
+import org.apache.jackrabbit.commons.collections.GrowingLRUMap;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyImpl;
 import org.apache.jackrabbit.core.SessionImpl;
@@ -70,8 +70,9 @@ public class MembershipCache implements 
         this.useMembersNode = useMembersNode;
 
         pMembers = systemSession.getJCRName(UserManagerImpl.P_MEMBERS);
-        cache = new LRUMap();
-                
+        @SuppressWarnings("unchecked")
+        cache = new GrowingLRUMap(1024, 5000);
+
         String[] ntNames = new String[] {
                 systemSession.getJCRName(UserConstants.NT_REP_GROUP),
                 systemSession.getJCRName(UserConstants.NT_REP_MEMBERS)
@@ -384,6 +385,8 @@ public class MembershipCache implements 
      * information. If both sets are non empty, the one configured in the
      * settings will take precedence and an warning is logged.
      *
+     * @param pIds
+     * @param nIds
      * @return
      */
     private Set<String> select(Set<String> pIds, Set<String> nIds) {
@@ -413,8 +416,6 @@ public class MembershipCache implements 
 
     /**
      * @return a new Session that needs to be properly released after usage.
-     * @throws RepositoryException
-     * @throws AccessDeniedException
      */
     private SessionImpl getSession() {
         try {

Added: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java?rev=1092106&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
(added)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
Thu Apr 14 10:33:35 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.commons.collections;
+
+import org.apache.commons.collections.map.LRUMap;
+
+/**
+ * <code>GrowingLRUMap</code> extends the LRUMap such that it can grow from
+ * the specified <code>initialSize</code> to the specified <code>maxSize</code>;
+ */
+public class GrowingLRUMap extends LRUMap {
+
+    private final int maxSize;
+
+    public GrowingLRUMap(int initialSize, int maxSize) {
+        super(initialSize);
+        this.maxSize = maxSize;
+    }
+
+    @Override
+    protected boolean removeLRU(LinkEntry entry) {
+        return size() > maxSize;
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/commons/collections/GrowingLRUMap.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message