public ParallelFileProcessingResult call() throws InterruptedException {
        if (alreadyExecuted) {
            throw new IllegalStateException("Can only execute BatchRunner once.");
        }
        //redirect streams; all organic warnings should go to System.err;
        //System.err should be redirected to System.out
        PrintStream sysErr = System.err;
        try {
            outputStreamWriter = new PrintStream(sysErr, true, UTF_8.toString());
        } catch (IOException e) {
            throw new RuntimeException("Can't redirect streams");
        }
        System.setErr(System.out);

        ParallelFileProcessingResult result = null;
        try {
            int numConsumers = consumersManager
                    .getConsumers()
                    .size();
            // fileResourceCrawler, statusReporter, the Interrupter, timeoutChecker
            int numNonConsumers = 2;
            if (interrupter != null) {
                numNonConsumers++;
            }
            if (reporter != null) {
                numNonConsumers++;
            }

            ExecutorService ex = Executors.newFixedThreadPool(numConsumers + numNonConsumers);
            CompletionService<IFileProcessorFutureResult> completionService = new ExecutorCompletionService<>(ex);
            TimeoutChecker timeoutChecker = new TimeoutChecker();

            try {
                startConsumersManager();
            } catch (BatchNoRestartError e) {
                return new ParallelFileProcessingResult(0, 0, 0, 0, 0, BatchProcessDriverCLI.PROCESS_NO_RESTART_EXIT_CODE,
                        CAUSE_FOR_TERMINATION.CONSUMERS_MANAGER_DIDNT_INIT_IN_TIME_NO_RESTART.toString());

            }

            State state = mainLoop(completionService, timeoutChecker);
            result = shutdown(ex, completionService, timeoutChecker, state);
        } finally {
            shutdownConsumersManager();
        }
        LOG.trace("finishing up");
        return result;
    }
Runs main execution loop.
<p>
Redirects stdout to stderr to keep clean communications
over stdout with parent process

@return result of the processing
@throws InterruptedException
tika-batch/src/main/java/org/apache/tika/batch/BatchProcess.java