public void run()

in src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java [102:152]


    public void run() {
        ServerSocket server = null;
        try {
            server = new ServerSocket();
            server.bind(socketAddress);
            log.info("Sling Control Server started on " + socketAddress.toString());
        } catch (IOException ioe) {
            log.error("Failed to start Sling Control Server", ioe);
            return;
        }

        try {
            while (true) {

                Socket s = server.accept();
                try {
                    String command = readLine(s);
                    log.info(s.getRemoteSocketAddress() + ">" + command);

                    if (COMMAND_STOP.equals(command)) {
                        if (mojo != null) {
                            mojo.stopSling();
                        }
                        writeLine(s, RESPONSE_OK);

                        log.info("Sling shut down, stopping Sling.");
                        mojo.stopSling();

                    } else if (COMMAND_STATUS.equals(command)) {
                        writeLine(s, RESPONSE_OK);

                    } else {
                        writeLine(s, "ERR:" + command);

                    }
                } finally {
                    try {
                        s.close();
                    } catch (IOException ignore) {
                    }
                }
            }
        } catch (IOException ioe) {
            log.error("Failure reading from client", ioe);
        } finally {
            try {
                server.close();
            } catch (IOException ignore) {
            }
        }
    }