public boolean isQueueEmpty() {
        int size = 0;
        synchronized (queue) {
            for (FileResource aQueue : queue) {
                if (!(aQueue instanceof PoisonFileResource)) {
                    size++;
                }
            }
        }
        return size == 0;
    }
Use sparingly.  This synchronizes on the queue!

@return whether this queue contains any non-poison file resources
tika-batch/src/main/java/org/apache/tika/batch/FileResourceCrawler.java