jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1352849 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/persistence/bundle/ main/java/org/apache/jackrabbit/core/persistence/mem/ main/java/org/apache/jackrabbit/core/persistence/pool/ test/java/org/apache/...
Date Fri, 22 Jun 2012 11:33:35 GMT
Author: jukka
Date: Fri Jun 22 11:33:34 2012
New Revision: 1352849

URL: http://svn.apache.org/viewvc?rev=1352849&view=rev
Log:
JCR-3263: Consistency checker performance improvements

Add a default implementation of getAllNodeInfos() in AbstractBundlePersistenceManager to avoid
having to reimplement the logic in all PMs.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java?rev=1352849&r1=1352848&r2=1352849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/AbstractBundlePersistenceManager.java
Fri Jun 22 11:33:34 2012
@@ -22,6 +22,8 @@ import static org.apache.jackrabbit.spi.
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -46,6 +48,7 @@ import org.apache.jackrabbit.core.persis
 import org.apache.jackrabbit.core.persistence.check.ConsistencyReport;
 import org.apache.jackrabbit.core.persistence.util.BLOBStore;
 import org.apache.jackrabbit.core.persistence.util.FileBasedIndex;
+import org.apache.jackrabbit.core.persistence.util.NodeInfo;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle;
 import org.apache.jackrabbit.core.persistence.util.NodePropBundle.PropertyEntry;
 import org.apache.jackrabbit.core.state.ChangeLog;
@@ -356,6 +359,18 @@ public abstract class AbstractBundlePers
         }
     }
 
+    //------------------------------------------< IterablePersistenceManager >--
+
+    @Override
+    public Map<NodeId, NodeInfo> getAllNodeInfos(NodeId after, int maxCount)
+            throws ItemStateException, RepositoryException {
+        Map<NodeId, NodeInfo> infos = new LinkedHashMap<NodeId, NodeInfo>();
+        for (NodeId nodeId : getAllNodeIds(after, maxCount)) {
+            infos.put(nodeId, new NodeInfo(loadBundle(nodeId)));
+        }
+        return infos;
+    }
+
     //----------------------------------------------------------------< spi >---
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java?rev=1352849&r1=1352848&r2=1352849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleFsPersistenceManager.java
Fri Jun 22 11:33:34 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.core.persistence.bundle;
 
-import org.apache.jackrabbit.core.persistence.util.NodeInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.commons.io.IOUtils;
@@ -43,11 +42,7 @@ import java.io.OutputStream;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.LinkedHashMap;
 import java.util.List;
-import java.util.Map;
-
-import javax.jcr.RepositoryException;
 
 /**
  * This is a generic persistence manager that stores the {@link NodePropBundle}s
@@ -504,18 +499,6 @@ public class BundleFsPersistenceManager 
     /**
      * {@inheritDoc}
      */
-    public Map<NodeId, NodeInfo> getAllNodeInfos(NodeId after, int maxCount) throws
ItemStateException, RepositoryException {
-        List<NodeId> nodeIds = getAllNodeIds(after, maxCount);
-        Map<NodeId, NodeInfo> result = new LinkedHashMap<NodeId, NodeInfo>(nodeIds.size());
-        for (NodeId nodeId : nodeIds) {
-            result.put(nodeId, new NodeInfo(loadBundle(nodeId)));
-        }
-        return result;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     protected NodeId getIdFromFileName(String fileName) {
         StringBuffer buff = new StringBuffer(35);
         if (!fileName.endsWith("." + NODEFILENAME)) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java?rev=1352849&r1=1352848&r2=1352849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/mem/InMemBundlePersistenceManager.java
Fri Jun 22 11:33:34 2012
@@ -503,18 +503,6 @@ public class InMemBundlePersistenceManag
     /**
      * {@inheritDoc}
      */
-    public Map<NodeId, NodeInfo> getAllNodeInfos(NodeId after, int maxCount) throws
ItemStateException, RepositoryException {
-        List<NodeId> nodeIds = getAllNodeIds(after, maxCount);
-        Map<NodeId, NodeInfo> result = new LinkedHashMap<NodeId, NodeInfo>(nodeIds.size());
-        for (NodeId nodeId : nodeIds) {
-            result.put(nodeId, new NodeInfo(loadBundle(nodeId)));
-        }
-        return result;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     @Override
     protected NodePropBundle loadBundle(NodeId id) throws ItemStateException {
         if (!bundleStore.containsKey(id)) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java?rev=1352849&r1=1352848&r2=1352849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/pool/BundleDbPersistenceManager.java
Fri Jun 22 11:33:34 2012
@@ -826,6 +826,7 @@ public class BundleDbPersistenceManager
     /**
      * {@inheritDoc}
      */
+    @Override
     public synchronized Map<NodeId, NodeInfo> getAllNodeInfos(NodeId bigger, int maxCount)
throws ItemStateException {
         ResultSet rs = null;
         try {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java?rev=1352849&r1=1352848&r2=1352849&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/ConsistencyCheckerImplTest.java
Fri Jun 22 11:33:34 2012
@@ -222,20 +222,6 @@ public class ConsistencyCheckerImplTest 
             return allNodeIds;
         }
 
-        public Map<NodeId, NodeInfo> getAllNodeInfos(final NodeId after, final int
maxCount) throws ItemStateException, RepositoryException {
-            Map<NodeId, NodeInfo> allNodeInfos = new LinkedHashMap<NodeId, NodeInfo>();
-            boolean add = after == null;
-            for (Map.Entry<NodeId, NodePropBundle> entry : bundles.entrySet()) {
-                if (add) {
-                    allNodeInfos.put(entry.getKey(), new NodeInfo(entry.getValue()));
-                }
-                if (!add) {
-                    add = entry.getKey().equals(after);
-                }
-            }
-            return allNodeInfos;
-        }
-
         @Override
         protected NodePropBundle loadBundle(final NodeId id) {
             return bundles.get(id);



Mime
View raw message