public void processRequests() {
        LOG.debug("processing requests");
        //initialize
        try {
            long start = System.currentTimeMillis();
            initializeResources();
            if (LOG.isTraceEnabled()) {
                LOG.trace("timer -- initialize parser and other resources: {} ms",
                        System.currentTimeMillis() - start);
            }
            LOG.debug("pipes server initialized");
        } catch (Throwable t) {
            LOG.error("couldn't initialize parser", t);
            try {
                output.writeByte(STATUS.FAILED_TO_START.getByte());
                output.flush();
            } catch (IOException e) {
                LOG.warn("couldn't notify of failure to start", e);
            }
            return;
        }
        //main loop
        try {
            write(STATUS.READY);
            long start = System.currentTimeMillis();
            while (true) {
                int request = input.read();
                if (request == -1) {
                    LOG.warn("received -1 from client; shutting down");
                    exit(1);
                } else if (request == STATUS.PING.getByte()) {
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("timer -- ping: {} ms", System.currentTimeMillis() - start);
                    }
                    write(STATUS.PING);
                    start = System.currentTimeMillis();
                } else if (request == STATUS.CALL.getByte()) {
                    parseOne();
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("timer -- parse one: {} ms", System.currentTimeMillis() - start);
                    }
                    start = System.currentTimeMillis();
                } else {
                    throw new IllegalStateException("Unexpected request");
                }
                output.flush();
            }
        } catch (Throwable t) {
            LOG.error("main loop error (did the forking process shut down?)", t);
            exit(1);
        }
        System.err.flush();
    }
This server is forked from the PipesClient.  This class isolates
parsing from the client to protect the primary JVM.
<p>
When configuring logging for this class, make absolutely certain
not to write to STDOUT.  This class uses STDOUT to communicate with
the PipesClient.
tika-core/src/main/java/org/apache/tika/pipes/PipesServer.java