|
|||||||||
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.DiscoveryMonitor
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:
domain:com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryResponder.group=224.224.224.222,port=4404
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 DiscoveryMonitor
can 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.
DiscoveryResponder
, Serialized FormField Summary | |
static int |
OFFLINE
Marks the "state" property as stopped. |
static int |
ONLINE
Marks the "state" property as runnig. |
static int |
STOPPING
Marks the "state" property as in-transition from ONLINE to OFFLINE. |
Constructor Summary | |
DiscoveryMonitor()
Constructs a DiscoveryMonitor . |
Method Summary | |
void |
addDiscoveryResponderListener(DiscoveryResponderListener x)
Registers a listener for receiving DiscoveryResponderListener events. |
void |
deleteCmf()
Invoked by the framework when it is requested to delete the DiscoveryClient . |
void |
deliverEvent(DiscoveryResponderEvent event)
For Java DMK internal use only. |
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 DiscoveryMonitor . |
java.lang.String |
getStateString()
Returns the state of this DiscoveryMonitor in string form. |
void |
initCmf(Framework cmf,
ObjectName name,
boolean db,
ModificationList list)
Invoked by the framework when it is requested to register the DiscoveryClient . |
void |
performStart()
Starts listening for DiscoveryResponder objects registering/deregistering. |
void |
performStop()
Stops this DiscoveryMonitor . |
void |
removeDiscoveryResponderListener(DiscoveryResponderListener x)
Removes a listener. |
void |
setMulticastGroup(java.lang.String multicastGroup)
Sets the multicast group name. |
void |
setMulticastPort(int multicastPort)
Sets the multicast port. |
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
Constructor Detail |
public DiscoveryMonitor() throws java.io.IOException
DiscoveryMonitor
.
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.
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()
DiscoveryResponder
objects registering/deregistering.
This method has no effect if the DiscoveryMonitor
is ONLINE
or
STOPPING
.
public void performStop()
DiscoveryMonitor
.
This method has no effect if the monitor is OFFLINE
or
STOPPING
.
public void addDiscoveryResponderListener(DiscoveryResponderListener x)
DiscoveryResponderListener
events.x
- The listener to add.public void removeDiscoveryResponderListener(DiscoveryResponderListener x)
x
- The listener to remove.public void deliverEvent(DiscoveryResponderEvent event)
public java.lang.String getClassVersion()
public java.lang.Integer getState()
DiscoveryMonitor
.ONLINE
,OFFLINE
or STOPPING
.public java.lang.String getStateString()
DiscoveryMonitor
in string form.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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |