All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryMonitor

java.lang.Object
   |
   +----com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryMonitor

public class DiscoveryMonitor
extends Object
implements Serializable
The DiscoveryMonitor class implements the m-bean that listens for registering and deregistering information sent by DiscoveryResponder objects on a given multicast group. Any agent that is to use multicast discovery must have a DiscoveryResponder registered in its framework. When a DiscoveryResponder is registered with or deregistered from a framework, it informs the rest of the multicast group by sending a multicast message. The format of this message is not exposed. Whenever a DiscoveryMonitor receives a registration or deregistration message, it sends a DiscoveryResponderEvent to its event listener.

A DiscoveryMonitor can be instantiated either in stand alone mode (Client side) or added to an agent. In the first case, the client should call the appropriate constructor to initialize the multicastGroup and multicastPort parameters. When a DiscoveryMonitor is added to a Java DMK agent, it uses the group and port specified by the properties multicastGroup and multicastPort. The default values for the group and the port are 224.224.224.224 and 9000. These values can be changed when the DiscoveryResponder is registered with the framework by specifying the group and port keys in the ObjectName. For instance if you want to register a DiscoveryMonitor which uses the group 224.224.224.222 and port 4404, use the following object name:

A DiscoveryMonitor can be stopped by calling the performStop method. When it is stopped, the DiscoveryMonitor no longer listens for registering and deregistering messages from DiscoveryResponder objects. A DiscoveryMonitorcan be restarted by invoking the performStart method.

A DiscoveryMonitor has a state property which reflects its activity.
DiscoveryMonitor State
running ONLINE
stopped OFFLINE
stopping STOPPING

The transition between ONLINE and OFFLINE may not be immediate. The DiscoveryMonitor may need some time to finish or interrupt the active requests. During this time the state of the DiscoveryMonitor is STOPPING. When a DiscoveryMonitor is added to a Java DMK agent, it is automatically started. When a DiscoveryMonitor is removed from a Java DMK agent, it is automatically stopped.


Variable Index

 o OFFLINE
 o ONLINE
 o STOPPING

Constructor Index

 o DiscoveryMonitor()
Class constructor.

Method Index

 o addDiscoveryResponderListener(DiscoveryResponderListener)
Registers a listener for receiving DiscoveryResponderListener events.
 o deleteCmf()
For Java DMK internal use only.
 o deliverEvent(DiscoveryResponderEvent)
For Java DMK internal use only.
 o getClassVersion()
Returns the version of this class.
 o getMulticastGroup()
Returns the multicast group.
 o getMulticastPort()
Returns the multicast port.
 o getState()
Returns the state of this DiscoveryMonitor.
 o getStateString()
Returns the state of this DiscoveryMonitor in string form.
 o initCmf(Framework, ObjectName, boolean, ModificationList)
For Java DMK internal use only.
 o performStart()
Starts listening for DiscoveryResponder objects registering/deregistering.
 o performStop()
Stops this DiscoveryMonitor.
 o removeDiscoveryResponderListener(DiscoveryResponderListener)
Removes a listener.
 o setMulticastGroup(String)
Sets the multicast group name.
 o setMulticastPort(int)
Sets the multicast port.

Variables

 o ONLINE
 public static final int ONLINE
 o OFFLINE
 public static final int OFFLINE
 o STOPPING
 public static final int STOPPING

Constructors

 o DiscoveryMonitor
 public DiscoveryMonitor() throws IOException
Class constructor. This constructor creates and initializes a multicast socket used to listen for DiscoveryResponder objects registering or deregistering. The default group (224.224.224.224) and port (9000) are used.

Throws: IOException
The creation of the socket failed.

Methods

 o initCmf
 public void initCmf(Framework cmf,
                     ObjectName name,
                     boolean db,
                     ModificationList list) throws IllegalAccessException, ServiceNotFoundException, InstanceAlreadyExistException
For Java DMK internal use only.

 o deleteCmf
 public void deleteCmf() throws InstanceNotFoundException, IllegalAccessException, ServiceNotFoundException
For Java DMK internal use only.

 o performStart
 public void performStart()
Starts listening for DiscoveryResponder objects registering/deregistering. This method has no effect if the DiscoveryMonitor is ONLINE or STOPPING.

 o performStop
 public void performStop()
Stops this DiscoveryMonitor. This method has no effect if the monitor is OFFLINE or STOPPING.

 o addDiscoveryResponderListener
 public synchronized void addDiscoveryResponderListener(DiscoveryResponderListener x)
Registers a listener for receiving DiscoveryResponderListener events. The method is compliant with the Bean design pattern.

Parameters:
x - The listener to add.
 o removeDiscoveryResponderListener
 public synchronized void removeDiscoveryResponderListener(DiscoveryResponderListener x)
Removes a listener.

Parameters:
x - The listener to remove.
 o deliverEvent
 public void deliverEvent(DiscoveryResponderEvent event)
For Java DMK internal use only.

 o getClassVersion
 public String getClassVersion()
Returns the version of this class.

Returns:
The version of this class.
 o getState
 public Integer getState()
Returns the state of this DiscoveryMonitor.

Returns:
ONLINE,OFFLINE or STOPPING.
 o getStateString
 public String getStateString()
Returns the state of this DiscoveryMonitor in string form.

Returns:
One of the strings "ONLINE", "OFFLINE" or "STOPPING".
 o getMulticastGroup
 public String getMulticastGroup()
Returns the multicast group.

Returns:
A string containing the multicast group name.
 o setMulticastGroup
 public void setMulticastGroup(String multicastGroup)
Sets the multicast group name. Only available if state in OFFLINE

Parameters:
multicastGroup - The multicast group name.
 o getMulticastPort
 public int getMulticastPort()
Returns the multicast port.

Returns:
The multicast port number.
 o setMulticastPort
 public void setMulticastPort(int multicastPort)
Sets the multicast port. Only available if state in OFFLINE

Parameters:
multicastPort - The multicast port.

All Packages  Class Hierarchy  This Package  Previous  Next  Index