jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1492688 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Date Thu, 13 Jun 2013 14:37:39 GMT
Author: mduerig
Date: Thu Jun 13 14:37:39 2013
New Revision: 1492688

URL: http://svn.apache.org/r1492688
Log:
OAK-871: RootImpl.hasPendingChanges is slow
Reuse the modification counter int RootImpl to determine whether the are pending changes instead
of testing the base state for equality with the head state.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1492688&r1=1492687&r2=1492688&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Thu Jun 13 14:37:39 2013
@@ -111,7 +111,7 @@ public class RootImpl implements Root {
      * Number of {@link #updated} occurred so since the last
      * purge.
      */
-    private int modCount;
+    private long modCount;
 
     private PermissionProvider permissionProvider;
 
@@ -308,7 +308,7 @@ public class RootImpl implements Root {
     @Override
     public boolean hasPendingChanges() {
         checkLive();
-        return !getSecureBase().equals(getSecureRootState());
+        return modCount > 0;
     }
 
     @Override
@@ -376,8 +376,7 @@ public class RootImpl implements Root {
 
     // TODO better way to determine purge limit. See OAK-175
     void updated() {
-        if (++modCount > PURGE_LIMIT) {
-            modCount = 0;
+        if (++modCount % PURGE_LIMIT == 0) {
             purgePendingChanges();
         }
     }



Mime
View raw message