public void processRequests() {
        //initialize
        try {
            initializeParserAndLoader();
        } catch (Throwable t) {
            t.printStackTrace();
            System.err.flush();
            try {
                output.writeByte(FAILED_TO_START);
                output.flush();
            } catch (IOException e) {
                e.printStackTrace();
                System.err.flush();
            }
            return;
        }
        //main loop
        try {
            while (true) {
                int request = input.read();
                if (request == -1) {
                    break;
                } else if (request == PING) {
                    output.writeByte(PING);
                } else if (request == CALL) {
                    call(classLoader, parser);
                } else {
                    throw new IllegalStateException("Unexpected request");
                }
                output.flush();
            }
        } catch (Throwable t) {
            t.printStackTrace();
        }
        System.err.flush();
    }
Starts a forked server process using the standard input and output
streams for communication with the parent process. Any attempts by
stray code to read from standard input or write to standard output
is redirected to avoid interfering with the communication channel.

@param args command line arguments, ignored
@throws Exception if the server could not be started
tika-core/src/main/java/org/apache/tika/fork/ForkServer.java