org.net2map.pov.p2p.MessageBroker Class Reference

Inheritance diagram for org.net2map.pov.p2p.MessageBroker:

Inheritance graph
[legend]
Collaboration diagram for org.net2map.pov.p2p.MessageBroker:

Collaboration graph
[legend]
List of all members.

Detailed Description

Some kind of "Postman" object: it receive messages, and dispatch them to tho objects who have "subscribed" to them.

Author:
Philippe MOULIN

Definition at line 37 of file MessageBroker.java.

Public Member Functions

synchronized void addPOV_MessageReceiver (POV_MessageReceiver theReceiver)
 Called by a POV_MessageReceiver when it wants to subscribe to a message tag.

synchronized void removePOV_MessageReceiver (String messageTag)
 Called by a POV_MessageReceiver when it want to unsubscribe.

synchronized void removePOV_MessageReceiver (POV_MessageReceiver theReceiver)
 Called by a POV_MessageReceiver when it want to unsubscribe.

synchronized void handleIncomingMessage (Message theMessage, RemoteNode theSender)
 Handle an incoming message.

synchronized void sendRequestToRemoteNodes (String theRequest, String theTag)
 Sends a request to remote nodes.

synchronized void sendResponseToRemoteNode (String theResponse, org.net2map.pov.p2p.RemoteNode theRequester, String theTag)
 Sends a response to a remote node.


Static Public Member Functions

MessageBroker getInstance ()
 This method creates the single instance if it hasn't been created yet and returns it.


Static Public Attributes

org.apache.log4j.Logger logger
 Log4j logger.


Private Member Functions

 MessageBroker ()
 Creates new MessageBroker.


Private Attributes

Hashtable colMessageTypes
 Each entry of this Hashtable contains a message type, and the message receiver who has subscribed to it.


Static Private Attributes

MessageBroker instance = null
 Singleton design pattern.


Constructor & Destructor Documentation

org.net2map.pov.p2p.MessageBroker.MessageBroker  )  [private]
 

Creates new MessageBroker.

Definition at line 76 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.colMessageTypes, and org.net2map.pov.p2p.MessageBroker.logger.

Referenced by org.net2map.pov.p2p.MessageBroker.getInstance().


Member Function Documentation

synchronized void org.net2map.pov.p2p.MessageBroker.addPOV_MessageReceiver POV_MessageReceiver  theReceiver  ) 
 

Called by a POV_MessageReceiver when it wants to subscribe to a message tag.

Parameters:
theReceiver The POV_MessageReceiver which wants to subscribe.

Definition at line 86 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.colMessageTypes, org.net2map.pov.p2p.POV_MessageReceiver.getAssociatedMessageTag(), and org.net2map.pov.p2p.MessageBroker.logger.

Here is the call graph for this function:

MessageBroker org.net2map.pov.p2p.MessageBroker.getInstance  )  [static]
 

This method creates the single instance if it hasn't been created yet and returns it.

Note the use of the Double-Checked Locking idiom.

Returns:
The single instance of this class.

Definition at line 61 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.instance, and org.net2map.pov.p2p.MessageBroker.MessageBroker().

Here is the call graph for this function:

synchronized void org.net2map.pov.p2p.MessageBroker.handleIncomingMessage Message  theMessage,
RemoteNode  theSender
 

Handle an incoming message.

Parameters:
theMessage The incoming message.
theSender The RemoteNode who has sent it.

Definition at line 113 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.colMessageTypes, org.net2map.pov.p2p.POV_MessageReceiver.getAssociatedMessageTag(), org.net2map.pov.p2p.RemoteNode.getPeerName(), org.net2map.pov.p2p.MessageBroker.logger, and org.net2map.pov.p2p.POV_MessageReceiver.processIncomingMessage().

Here is the call graph for this function:

synchronized void org.net2map.pov.p2p.MessageBroker.removePOV_MessageReceiver POV_MessageReceiver  theReceiver  ) 
 

Called by a POV_MessageReceiver when it want to unsubscribe.

Parameters:
theReceiver The POV_MessageReceiver which wants to unsubscribe.

Definition at line 105 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.colMessageTypes, and org.net2map.pov.p2p.POV_MessageReceiver.getAssociatedMessageTag().

Here is the call graph for this function:

synchronized void org.net2map.pov.p2p.MessageBroker.removePOV_MessageReceiver String  messageTag  ) 
 

Called by a POV_MessageReceiver when it want to unsubscribe.

Parameters:
messageTag The Message Tag which should be removed.

Definition at line 98 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.colMessageTypes.

synchronized void org.net2map.pov.p2p.MessageBroker.sendRequestToRemoteNodes String  theRequest,
String  theTag
 

Sends a request to remote nodes.

Parameters:
theRequest The request message
theTag The Message Tag associated wit that request.

Definition at line 141 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.logger.

synchronized void org.net2map.pov.p2p.MessageBroker.sendResponseToRemoteNode String  theResponse,
org.net2map.pov.p2p.RemoteNode  theRequester,
String  theTag
 

Sends a response to a remote node.

Parameters:
theResponse The response
theRequester The node which made the request this response is reponding to.
theTag The Message Tag associated with the response.

Definition at line 169 of file MessageBroker.java.

References org.net2map.pov.p2p.MessageBroker.logger.


Member Data Documentation

Hashtable org.net2map.pov.p2p.MessageBroker.colMessageTypes [private]
 

Each entry of this Hashtable contains a message type, and the message receiver who has subscribed to it.

Definition at line 48 of file MessageBroker.java.

Referenced by org.net2map.pov.p2p.MessageBroker.addPOV_MessageReceiver(), org.net2map.pov.p2p.MessageBroker.handleIncomingMessage(), org.net2map.pov.p2p.MessageBroker.MessageBroker(), and org.net2map.pov.p2p.MessageBroker.removePOV_MessageReceiver().

MessageBroker org.net2map.pov.p2p.MessageBroker.instance = null [static, private]
 

Singleton design pattern.

Definition at line 54 of file MessageBroker.java.

Referenced by org.net2map.pov.p2p.MessageBroker.getInstance().

org.apache.log4j.Logger org.net2map.pov.p2p.MessageBroker.logger [static]
 

Initial value:

 
    org.apache.log4j.Logger.getLogger(MessageBroker.class.getName())
Log4j logger.

Definition at line 42 of file MessageBroker.java.

Referenced by org.net2map.pov.p2p.MessageBroker.addPOV_MessageReceiver(), org.net2map.pov.p2p.MessageBroker.handleIncomingMessage(), org.net2map.pov.p2p.MessageBroker.MessageBroker(), org.net2map.pov.p2p.MessageBroker.sendRequestToRemoteNodes(), and org.net2map.pov.p2p.MessageBroker.sendResponseToRemoteNode().


The documentation for this class was generated from the following file:
Accueil | Téléchargement | Manuel | Doc. technique | Sources CVS | Faq | Nous contacter
©2003 - All Rights Reserved