public IFileProcessorFutureResult call() {
        currentState = STATE.ACTIVELY_CONSUMING;

        try {
            FileResource fileResource = getNextFileResource();
            while (fileResource != null) {
                LOG.trace("file consumer is about to process: {}", fileResource.getResourceId());
                boolean consumed = _processFileResource(fileResource);
                LOG.trace("file consumer has finished processing: {}", fileResource.getResourceId());

                if (consumed) {
                    numResourcesConsumed.incrementAndGet();
                }
                fileResource = getNextFileResource();
            }
        } catch (InterruptedException e) {
            setEndedState(STATE.THREAD_INTERRUPTED);
        }

        setEndedState(STATE.COMPLETED);
        return new FileConsumerFutureResult(currentFile, numResourcesConsumed.get());
    }
This is a base class for file consumers. The
goal of this class is to abstract out the multithreading
and record keeping components.
<p/>
tika-batch/src/main/java/org/apache/tika/batch/FileResourceConsumer.java