All Packages  Class Hierarchy  This Package  Previous  Next  Index

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

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

public class DiscoveryResponder
extends Object
implements Serializable, ActivatableIf
The DiscoveryResponder class implements the m-bean that responds to the discovery requests. Any agent that needs to be discovered must instantiate and register a DiscoveryResponder in its framework.

When a DiscoveryResponder is registered in the framework, or when performStart method is called, the m-bean starts a thread which creates a multicast socket. The DiscoveryResponder then sends a join message to the multicast group. When a DiscoveryResponder is deleted from the framework, or when performStop method is called, the m-bean sends a leave message to the multicast group. The format of these messages is not exposed. These messages allow DiscoveryMonitor objects to maintain a list of agents with DiscoveryResponder objects registered in their frameworks. When a DiscoveryResponder has registered in the framework -or when performStart method is called - and a join message has been sent, the DiscoveryResponder starts to listen for discovery requests.

The multicast socket 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 in the framework by specifying the group and port keys in the ObjectName. These values can be also changed using setMulticastGroup and setMulticastPort methods when the DiscoveryResponder is OFFLINE

When join/leave message are sent to the multicast group, a default time-to-live (see java.net.MulticastSocket) value is used. The time-to-live value specifies how many "hops" that the packet is forwarded on the network before it expires. DiscoveryResponder objects use a time-to-live specified by the property ttl. The default time-to-live value is 1. This can be changed when the DiscoveryResponder is registered in the framework by specifying the ttl keys in the ObjectName. It can be be also changed using setTimeToLive method when the DiscoveryResponder is OFFLINE

For example, to register a DiscoveryResponder that uses the group 224.224.224.222, port 4404 and sends multicast join and leave messages through 4 hops, use the following object name:

See Also:
DiscoveryClient

Variable Index

 o OFFLINE
 o ONLINE
 o STOPPING

Constructor Index

 o DiscoveryResponder()
For Java DMK internal use only.
 o DiscoveryResponder(Framework)
Class constructor.

Method Index

 o deleteCmf()
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 DiscoveryResponder.
 o getStateString()
Returns the state of this DiscoveryResponder in string form.
 o getTimeToLive()
Returns the time-to-live value.
 o initCmf(Framework, ObjectName, boolean, ModificationList)
For Java DMK internal use only.
 o isActive()
Tests if the AdaptorServer is active.
 o performStart()
 o performStop()
 o setMulticastGroup(String)
Sets the multicast group name.
 o setMulticastPort(int)
Sets the multicast port.
 o setTimeToLive(int)
Sets the default Time to Live to be used to send join and leave message to the Multicast group.

Variables

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

Constructors

 o DiscoveryResponder
 public DiscoveryResponder()
For Java DMK internal use only.

 o DiscoveryResponder
 public DiscoveryResponder(Framework cmf)
Class constructor. Creates a discovery responder using the default multicast group (224.224.224.224) and the default multicast port (9000). The multicast group and port values can be overwritten using setter the properties multicastGroup and multicastPort.

Parameters:
cmf - The actual JDMK framework object.

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()
 o performStop
 public void performStop()
 o isActive
 public boolean isActive()
Tests if the AdaptorServer is active.

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

Returns:
The version of this class.
 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.
 o getTimeToLive
 public int getTimeToLive()
Returns the time-to-live value.

Returns:
The time-to-live value.
 o setTimeToLive
 public void setTimeToLive(int ttl)
Sets the default Time to Live to be used to send join and leave message to the Multicast group. Time to Live should an integer verifying the following condition: 0 < ttl <= 255 Only available if state in OFFLINE

Parameters:
ttl - The Time to live value.
 o getState
 public Integer getState()
Returns the state of this DiscoveryResponder.

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

Returns:
One of the strings "ONLINE", "OFFLINE" or "STOPPING".

All Packages  Class Hierarchy  This Package  Previous  Next  Index