moses.member
Class Receiver

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--moses.member.Receiver
All Implemented Interfaces:
java.lang.Runnable

public class Receiver
extends java.lang.Thread

This class allows the receiving of LGI messages asynchronously, thus supplementing the Member class. Messages arriving at a Member instance are dispatched by this receiver to any provided class that implements the Agent interface. A typical usage of this class is as follows:
 
 


 
    Member m = new Member(...);
    AgentInstance ai = ...;
 
    m.adopt(...);
 
    Receiver r = new Receiver(ai, m);
    r.start();
 
    

Following the arrival of a message at the member, a corresponding method of the Agent instance is called with the message payload as argument.
 
  In the future this class will be deprecated in favor to the more general GenericReceiver class.

See Also:
Member, GenericReceiver, Agent, GenericAgent

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Receiver(moses.member.Agent agent, moses.member.Member member)
          The constructor of the class creates a new receiver object.
 
Method Summary
 void run()
          This method implements the main thread of the receiver.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Receiver

public Receiver(moses.member.Agent agent,
                moses.member.Member member)
The constructor of the class creates a new receiver object.

Parameters:
agent - specifies an object that implements an Agent interface
member - represents a member instance connected to its controller
Method Detail

run

public void run()
This method implements the main thread of the receiver. It waits for a message to arrive at the member, and when it gets it, it dispatches the message for processing at the agent interface;
If an error happens during the receiving of a message (such as those raised during member's disconnection) a message is displayed at the standard output and the receiving thread terminates its execution.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread