|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryResponder
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:
domain:com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryResponder.group=224.224.224.222,port=4404,ttl=4
DiscoveryClient
,
DiscoveryMonitor
, Serialized FormField Summary | |
static int |
OFFLINE
Marks the "state" property as stopped. |
static int |
ONLINE
Marks the "state" property as runnig. |
protected int |
state
Reflects the current state of the discovery responder. |
static int |
STOPPING
Marks the "state" property as in-transition from ONLINE to OFFLINE. |
Constructor Summary | |
DiscoveryResponder()
Constructs a DiscoveryResponder . |
|
DiscoveryResponder(Framework cmf)
Constructs a DiscoveryResponder . |
Method Summary | |
void |
deleteCmf()
Invoked by the framework when it is requested to delete the DiscoveryClient . |
java.lang.String |
getClassVersion()
Returns the version of this class. |
java.lang.String |
getMulticastGroup()
Returns the multicast group. |
int |
getMulticastPort()
Returns the multicast port. |
java.lang.Integer |
getState()
Returns the state of this DiscoveryResponder . |
java.lang.String |
getStateString()
Returns the state of this DiscoveryResponder in string form. |
int |
getTimeToLive()
Returns the time-to-live value. |
void |
initCmf(Framework cmf,
ObjectName name,
boolean db,
ModificationList list)
Invoked by the framework when it is requested to register the DiscoveryClient . |
boolean |
isActive()
Tests if the DiscoveryResponder is active. |
void |
performStart()
Starts a thread which creates a multicast socket and sends a join message to the multicast group. |
void |
performStop()
Sends a leave message to the multicast group and stops the multicast socket thread. |
void |
setMulticastGroup(java.lang.String multicastGroup)
Sets the multicast group name. |
void |
setMulticastPort(int multicastPort)
Sets the multicast port. |
void |
setTimeToLive(int ttl)
Sets the default Time to Live to be used to send join and leave message to the Multicast group. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int ONLINE
public static final int OFFLINE
public static final int STOPPING
protected transient int state
Constructor Detail |
public DiscoveryResponder()
DiscoveryResponder
.
For Java DMK internal use only.
public DiscoveryResponder(Framework cmf)
DiscoveryResponder
.
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
.
cmf
- The actual JDMK framework object.Method Detail |
public void initCmf(Framework cmf, ObjectName name, boolean db, ModificationList list) throws InstanceAlreadyExistException
DiscoveryClient
.
For Java DMK internal use only.
cmf
- The core management framework to register the service with.name
- Object name containing configuration information.db
- Indicates if persistent storage is required.list
- The modification list to use for setting up parameters.public void deleteCmf()
DiscoveryClient
.
For Java DMK internal use only.
public void performStart()
public void performStop()
public boolean isActive()
DiscoveryResponder
is active.public java.lang.String getClassVersion()
public java.lang.String getMulticastGroup()
public void setMulticastGroup(java.lang.String multicastGroup)
Only available if state in OFFLINE
multicastGroup
- The multicast group name.public int getMulticastPort()
public void setMulticastPort(int multicastPort)
Only available if state in OFFLINE
multicastPort
- The multicast port.public int getTimeToLive()
public void setTimeToLive(int ttl)
Time to Live should an integer verifying the following condition: 0 < ttl <= 255 Only available if state in OFFLINE
ttl
- The Time to live value.public java.lang.Integer getState()
DiscoveryResponder
.ONLINE
, OFFLINE
or STOPPING
.public java.lang.String getStateString()
DiscoveryResponder
in string form.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |