|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DiscoveryMonitorMBean
Describe an MBean that listens for registering and unregistering 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 MBean server.
When a DiscoveryResponder
is registered in an MBean server and when its start or stop methods
are called, 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
unregistration message, it sends a DiscoveryResponderNotification
to its notification listener.
A DiscoveryMonitor
can be instantiated either in stand alone
mode (Client side) or added to an MBean Server. In the first case, the client should
call the appropriate constructor to initialize the multicastGroup
and multicastPort
parameters.
The default values for the group and the port are 224.224.224.224 and
9000.
A DiscoveryMonitor
can be stopped by calling the stop
method. When it is stopped, the
DiscoveryMonitor
no longer listens for registering and
unregistering messages from DiscoveryResponder
objects.
A DiscoveryMonitor
can be restarted by invoking the start
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 removed from a Java DMK agent, it is automatically stopped.
Method Summary | |
---|---|
String |
getMulticastGroup()
Returns the multicast group. |
int |
getMulticastPort()
Returns the multicast port. |
Integer |
getState()
Returns the state of this DiscoveryMonitor . |
String |
getStateString()
Returns the state of this DiscoveryMonitor in string form. |
void |
setMulticastGroup(String multicastGroup)
Sets the multicast group name. |
void |
setMulticastPort(int multicastPort)
Sets the multicast port. |
void |
start()
Starts listening for DiscoveryResponder objects registering/unregistering. |
void |
stop()
Stops this DiscoveryMonitor . |
boolean |
waitState(int state,
long timeout)
Waits until either the State attribute of this MBean equals the specified state parameter, or the specified timeout has elapsed. |
Method Detail |
---|
void start() throws IOException
DiscoveryResponder
objects registering/unregistering.
This method has no effect if the DiscoveryMonitor
is ONLINE
or
STOPPING
.
IOException
- The creation of the Multicast socket failed.void stop()
DiscoveryMonitor
.
This method has no effect if the monitor is OFFLINE
or
STOPPING
.
Integer getState()
DiscoveryMonitor
.
ONLINE
,OFFLINE
or STOPPING
.String getStateString()
DiscoveryMonitor
in string form.
String getMulticastGroup()
void setMulticastGroup(String multicastGroup) throws IllegalStateException
Only available if state in OFFLINE
multicastGroup
- The multicast group name.
IllegalStateException
- This method has been invoked while
the DiscoveryMonitor
was ONLINE or STARTING.int getMulticastPort()
void setMulticastPort(int multicastPort) throws IllegalStateException
Only available if state in OFFLINE
multicastPort
- The multicast port.
IllegalStateException
- This method has been invoked while
the DiscoveryMonitor
was ONLINE or STARTING.boolean waitState(int state, long timeout)
waitState
returns with a boolean value indicating whether the specified
state parameter equals the value of this MBean's State
attribute at the time the method terminates.
Two special cases for the timeout parameter value are:
waitState
returns immediately (i.e. does not wait at all),waitState
waits until the value of this MBean's State attribute
is the same as the state parameter (i.e. will wait
indefinitely if this condition is never met).
state
- The value of this MBean's State attribute to wait for.
state can be one of:
DiscoveryMonitor.OFFLINE
,
DiscoveryMonitor.ONLINE
,
DiscoveryMonitor.STARTING
,
DiscoveryMonitor.STOPPING
.timeout
- The maximum time to wait for, in
milliseconds, if positive. Infinite time out if 0, or no
waiting at all if negative.
true
if the value of this MBean's State attribute
is the same as the state parameter;
false
otherwise.
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |