private static void mainLoop(TikaServerConfig tikaServerConfig) throws Exception {

        List<PortIdPair> portIdPairs = getPortIdPairs(tikaServerConfig);

        ExecutorService executorService = Executors.newFixedThreadPool(portIdPairs.size());
        ExecutorCompletionService<WatchDogResult> executorCompletionService = new ExecutorCompletionService<>(executorService);

        for (PortIdPair p : portIdPairs) {
            TikaServerWatchDog watcher = new TikaServerWatchDog(p.port, p.id, tikaServerConfig);
            executorCompletionService.submit(watcher);
            WATCHERS.add(watcher);
        }

        int finished = 0;
        try {
            while (finished < portIdPairs.size()) {
                Future<WatchDogResult> future = executorCompletionService.poll(1, TimeUnit.MINUTES);
                if (future != null) {
                    LOG.debug("main loop future is available");
                    WatchDogResult result = future.get();
                    LOG.debug("main loop future: ({}); finished", result);
                    finished++;
                }
            }
        } catch (InterruptedException e) {
            for (TikaServerWatchDog w : WATCHERS) {
                w.shutDown();
            }
            LOG.debug("thread interrupted", e);
        } finally {
            //this is just asking nicely...there is no guarantee!
            executorService.shutdownNow();
        }
    }
This value is set to the server's id in the forked process.
tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerCli.java