Ejemplo n.º 1
0
  /**
   * This will parse out the command. Lookup the appropriate Handler and pass the information to the
   * handler for processing.
   *
   * <p>Dev Note: the command parsing is processed here so that it is preformed by the assigned
   * thread rather than the listeners thread.
   */
  public void run() {
    try {
      logger.trace("start listening for cluster messages");
      SocketConnection sc = new SocketConnection(clientSocket);
      while (true) {
        if (owner.process(sc)) {
          // got the offline message or timeout
          break;
        }
      }
      logger.trace("disconnecting: {}", hostPort);
      sc.disconnect();

    } catch (Exception e) {
      logger.error("Error listening for messages - " + owner.getHostPort(), e);
    }
  }
Ejemplo n.º 2
0
 /** Create including the Listener (used to lookup the Request Handler) and the socket itself. */
 public RequestProcessor(SocketClusterBroadcast owner, Socket clientSocket) {
   this.clientSocket = clientSocket;
   this.owner = owner;
   this.hostPort = owner.getHostPort();
 }