All Packages Class Hierarchy This Package Previous Next Index
Class sics.agentbase.core.MessageDispatcher
java.lang.Object
|
+----sics.agentbase.core.MessageDispatcher
- public class MessageDispatcher
- extends Object
-
MessageDispatcher()
-
-
addMessageListener(String, MessageListener)
- Adds a message listener with the specified name.
-
deliverMessage(Message)
- Delivers a message to a message listener.
-
getDefaultMessageDispatcher()
- Returns the default MessageDispatcher.
-
getMessageListener(String)
- Returns the message listener with the specified name.
-
removeMessageListener(String)
- Removes the message listener with the specified name.
MessageDispatcher
public MessageDispatcher()
getDefaultMessageDispatcher
public static MessageDispatcher getDefaultMessageDispatcher()
- Returns the default MessageDispatcher.
- Returns:
- the default MessageDispatcher object.
addMessageListener
public synchronized void addMessageListener(String name,
MessageListener listener)
- Adds a message listener with the specified name.
- Parameters:
- name - the name of the message listener to add.
- listener - the message listener to be added.
removeMessageListener
public synchronized void removeMessageListener(String name)
- Removes the message listener with the specified name.
- Parameters:
- name - the name of the message listener to remove.
getMessageListener
public MessageListener getMessageListener(String name)
- Returns the message listener with the specified name.
- Parameters:
- name - the name of the message listener to return.
- Returns:
- the message listener or
null if no message
listener with the specified name exists.
deliverMessage
public void deliverMessage(Message msg)
- Delivers a message to a message listener. The value returned from
the method
getLocalReceiver in the message is used to
deliver the message to a message listener with matching name.
If no message listener can be found, the method error
in the message is invoked with the error RECEIVER_UNKNOWN.
- Parameters:
- msg - the message to be added.
- See Also:
- RECEIVER_UNKNOWN, getLocalReceiver, error
All Packages Class Hierarchy This Package Previous Next Index