You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2014/01/29 15:36:21 UTC

svn commit: r1562457 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java

Author: jukka
Date: Wed Jan 29 14:36:21 2014
New Revision: 1562457

URL: http://svn.apache.org/r1562457
Log:
OAK-1332: Large number of changes to the same node can fill observation queue

Make the continuations Runnable again as suggested by Michael.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java?rev=1562457&r1=1562456&r2=1562457&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/EventGenerator.java Wed Jan 29 14:36:21 2014
@@ -70,7 +70,7 @@ public class EventGenerator {
      */
     private static final int MAX_QUEUED_CONTINUATIONS = 1000;
 
-    private final LinkedList<Continuation> continuations = newLinkedList();
+    private final LinkedList<Runnable> continuations = newLinkedList();
 
     /**
      * Creates a new generator instance for processing the given changes.
@@ -97,12 +97,11 @@ public class EventGenerator {
      */
     public void generate() {
         if (!continuations.isEmpty()) {
-            Continuation c = continuations.removeFirst();
-            c.after.compareAgainstBaseState(c.before, c);
+            continuations.removeFirst().run();
         }
     }
 
-    private class Continuation implements NodeStateDiff {
+    private class Continuation implements NodeStateDiff, Runnable {
 
         /**
          * Filtered handler of detected content changes.
@@ -138,6 +137,17 @@ public class EventGenerator {
             this.skip = skip;
         }
 
+        //------------------------------------------------------< Runnable >--
+
+        /**
+         * Continues the content diff from the point where this
+         * continuation was created.
+         */
+        @Override
+        public void run() {
+            after.compareAgainstBaseState(before, this);
+        }
+
         //-------------------------------------------------< NodeStateDiff >--
 
         @Override