void () { if (((BoundedTaskExecutor)changedDocumentExecutor).isEmpty()) return; if (ApplicationManager.getApplication().isWriteAccessAllowed()) { throw new IllegalStateException("Must not call clearDocumentQueue() from under write action because some queued detectors require read action"); } ((BoundedTaskExecutor)changedDocumentExecutor).clearAndCancelAll(); // after clear and canceling all queued tasks, make sure they all are finished waitAllTasksExecuted(1, TimeUnit.MINUTES); }