Author: stefanegli
Date: Mon Sep 11 14:37:02 2017
New Revision: 1808032
URL: http://svn.apache.org/viewvc?rev=1808032&view=rev
Log:
OAK-6639 : test stability fix : added 2sec sleep to give BackgroundObserver's
thread enough time to process initial, empty contentChanged call
Modified:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationQueueFullWarnTest.java
Modified:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationQueueFullWarnTest.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationQueueFullWarnTest.java?rev=1808032&r1=1808031&r2=1808032&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationQueueFullWarnTest.java
(original)
+++
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/observation/ObservationQueueFullWarnTest.java
Mon Sep 11 14:37:02 2017
@@ -287,6 +287,19 @@ public class ObservationQueueFullWarnTes
session.save();
observationManager.addEventListener(listeners, Event.PROPERTY_ADDED,
"/", true, null, null, false);
+
+ // OAK-6639 : the above addEventListener registers an Observer with
the NodeStore
+ // that (an Observable in general) in turn as the very first activity
does a contentChanged call (with
+ // CommitInfo.EMPTY_EXTERNAL) to 'initialize' the Observer
+ // (see eg
https://github.com/apache/jackrabbit-oak/blob/2634dbde9aedc2549f0512285e9abee5858b256f/oak-store-spi/src/main/java/org/apache/jackrabbit/oak/spi/commit/ChangeDispatcher.java#L66)
+ // normally that initial call should be processed very quickly by the
+ // BackgroundObserver, but it seems like there are some cases where
+ // this (main) thread gets priority and is able to do the 6
session.save
+ // calls before the BackgroundObserver is able to dequeue the
'init-token'.
+ // in *that* case the queue overfills unexpectedly.
+ // To avoid this, give the BackgroundObserver 2sec here to process the
+ // init-token, so that the test can actually start with an empty
BackgroundObserver queue
+ Thread.sleep(2000);
int propCounter = 0;
// send out 6 events (or in general: queue length + 1):