private void shutdown() throws InterruptedException {
        LOG.debug("FileResourceCrawler entering shutdown");
        if (hasCompletedCrawling || shutDownNoPoison) {
            return;
        }
        int i = 0;
        long start = System.currentTimeMillis();
        while (queue.offer(new PoisonFileResource(), 1L, TimeUnit.SECONDS)) {
            if (shutDownNoPoison) {
                LOG.debug("quitting the poison loop because shutDownNoPoison is now true");
                return;
            }
            if (Thread
                    .currentThread()
                    .isInterrupted()) {
                LOG.debug("thread interrupted while trying to add poison");
                return;
            }
            long elapsed = System.currentTimeMillis() - start;
            if (maxConsecWaitInMillis > -1 && elapsed > maxConsecWaitInMillis) {
                LOG.error("Crawler timed out while trying to add poison");
                return;
            }
            LOG.debug("added {} number of PoisonFileResource(s)", i);
            if (i++ >= numConsumers) {
                break;
            }

        }
        hasCompletedCrawling = true;
    }
@param fileResource resource to add
@return int status of the attempt (SKIPPED, ADDED, STOP_NOW) to add the resource to the queue.
@throws InterruptedException
tika-batch/src/main/java/org/apache/tika/batch/FileResourceCrawler.java