jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1559839 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index: AsyncIndexUpdate.java IndexUpdateCallback.java
Date Mon, 20 Jan 2014 22:07:00 GMT
Author: jukka
Date: Mon Jan 20 22:07:00 2014
New Revision: 1559839

URL: http://svn.apache.org/r1559839
Log:
OAK-1292: Avoid async indexer commits when there are no changes to index

Turn IndexUpdateCallback to an interface

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateCallback.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java?rev=1559839&r1=1559838&r2=1559839&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java
Mon Jan 20 22:07:00 2014
@@ -114,14 +114,11 @@ public class AsyncIndexUpdate implements
         final AtomicBoolean dirty = new AtomicBoolean(false);
 
         IndexUpdateCallback callback = new IndexUpdateCallback() {
-
             @Override
-            public void beforeIndex() throws CommitFailedException {
-                if (dirty.get()) {
-                    return;
+            public void indexUpdate() throws CommitFailedException {
+                if (dirty.getAndSet(true)) {
+                    preAsyncRun(store, name);
                 }
-                preAsyncRun(store, name);
-                dirty.set(true);
             }
         };
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateCallback.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateCallback.java?rev=1559839&r1=1559838&r2=1559839&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateCallback.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdateCallback.java
Mon Jan 20 22:07:00 2014
@@ -18,21 +18,8 @@ package org.apache.jackrabbit.oak.plugin
 
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 
-public abstract class IndexUpdateCallback {
+public interface IndexUpdateCallback {
 
-    private boolean dirty = false;
-
-    public void indexUpdate() throws CommitFailedException {
-        if (!dirty) {
-            dirty = true;
-            beforeIndex();
-        }
-    }
-
-    /**
-     * Called when the indexer finds the first changes that need indexing when
-     * running the diff
-     */
-    abstract protected void beforeIndex() throws CommitFailedException;
+    void indexUpdate() throws CommitFailedException;
 
 }



Mime
View raw message