Index: oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java (revision 05b477f6673d9eb6bc7c2e0befb3a24fa6f52c0c) +++ oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/BackgroundObserver.java (revision ) @@ -52,6 +52,8 @@ */ public class BackgroundObserver implements Observer, Closeable { + private static final Logger LOG = LoggerFactory.getLogger(BackgroundObserver.class); + /** * Signal for the background thread to stop processing changes. */ @@ -104,6 +106,11 @@ private volatile ListenableFutureTask currentTask = ListenableFutureTask.completed(); /** + * The max queue length used for this observer's queue + */ + private int maxQueueLength; + + /** * Completion handler: set the current task to the next task and schedules that one * on the background thread. */ @@ -144,7 +151,8 @@ this.observer = checkNotNull(observer); this.executor = checkNotNull(executor); this.exceptionHandler = checkNotNull(exceptionHandler); - this.queue = newArrayBlockingQueue(queueLength); + this.maxQueueLength = queueLength; + this.queue = newArrayBlockingQueue(maxQueueLength); } public BackgroundObserver( @@ -172,6 +180,18 @@ protected void added(int queueSize) { } /** + * Private utility to report queue size to observers + * @param queueSize current size of the queue + */ + private void reportAdded(int queueSize){ + if(queueSize == maxQueueLength ){ + LOG.warn("Revision queue for observer {} is full (max = {}). Further revisions will be compacted.", + observer != null ? observer.getClass().getName(): "", maxQueueLength); + } + added(queueSize); + } + + /** * Clears the change queue and signals the background thread to stop * without making any further {@link #contentChanged(NodeState, CommitInfo)} * calls to the background observer. If the thread is currently in the @@ -232,7 +252,7 @@ // to onComplete are not a problem here since we always pass the same value. // Thus there is no question as to which of the handlers will effectively run. currentTask.onComplete(completionHandler); - added(queue.size()); + reportAdded(queue.size()); } //------------------------------------------------------------< internal >---