Class Receiver

All Implemented Interfaces:
Runnable

public class Receiver extends Service
Listens for incoming messages on a certain input stream, and sends them to the appropriate location.
Author:
Bryan Tripp
  • Constructor Details

  • Method Details

    • setParserExeptionHandler

    • handle

      protected void handle()
      Description copied from class: Service
      The main task of the thread, called in a loop as long as Service.isRunning() returns true. Overridden methods are responsible for yielding or pausing the thread when it's idle. The method must also not block indefinitely so that a call to Service.stop() is able to gracefully terminate the thread.
      Specified by:
      handle in class Service
    • processMessage

      protected void processMessage(String message)
      Processes a single incoming message by sending it to the appropriate internal location. If an incoming message contains an MSA-2 field, it is assumed that this message is meant as a reply to a message that has been sent earlier. In this case an attempt is give the message to the object that sent the corresponding outbound message. If the message contains an MSA-2 but there are no objects that appear to be waiting for it, it is discarded and an exception is logged. If the message does not contain an MSA-2 field, it is concluded that the message has arrived unsolicited. In this case it is sent to the Responder (in a new Thread).