All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----com.sun.jaw.impl.agent.services.jawdiscovery.DiscoveryClient
DiscoveryClient class provides methods to discover agents.
An agent can only discovered if it has a
DiscoveryResponder registered in its framework.
A discovery operation is executed in two steps:
DiscoveryClient broadcasts a discovery request on a
MulticastSocketDiscoveryResponder objects listening on the multicast group
catch the request. Each DiscoveryResponder
sends a discovery response to the DiscoveryClient
A DiscoveryClient can only reach the
DiscoveryResponder objects that listen on the same multicast group and
port. The default group is 224.224.224.224 and the default port is 9000. Other values
can be used by configuring the multicastGroup and
multicastPort properties on the DiscoveryClient
and DiscoveryResponder objects.
The scope of the discovery depends on the time-to-live used by
the MulticastSocket. By default, the time-to-live is 1. It
can be changed by setting the property timeToLive on the
DiscoveryClient.
After it has sent its discovery request, a DiscoveryClient
waits a finite time for responses. The default is 1 second.
This can be customized by setting the timeOut property on the
DiscoveryClient.
An application triggers a discovery operation by invoking either the
performFindHosts method or the performFindAdaptors
method on a DiscoveryClient object.
These methods represent the discovery result by a Vector of
DiscoveryResponse. A DiscoveryResponse is included
for each discovered agent, it provides the host of the agent and optionally
the list of adaptors available in the agent.
A DiscoveryResponder can send back responses using two modes:
DiscoveryResponder
to the DiscoveryClient. The response is NOT multicasted to the group.
The default datagram socket port is 9001. The port number can be changed using the
setPointToPointResponsePort method. Invoking this method with a negative
value unsets unicast response mode and multicast response mode is used. The
datagram socket inet address is defined by the local host name. It cannot be customized.
DiscoveryResponder
and the DiscoveryClient. The response is multicasted to the group. This
behavior allows DiscoveryMonitor objects to be aware of changes.
To enable multicast mode, either invoke setPointToPointResponsePort with a
negative value or invoke the unsetPointToPointResponsePort.
It is possible to instantiate multiple DiscoveryClient objects with
different groups and ports for multicast responses and datagram sockets for unicast responses.
DiscoveryResponder.
DiscoveryResponder in string form.
AdaptorServer is active.
DiscoveryResponder
registered in its framework is on a host.
DiscoveryClient,
the socket joins its multicast group.
DiscoveryClient,
the socket leaves its multicast group.
DiscoveryClient waits
for discovery responses.
DiscoveryClient.
public static final int ONLINE
public static final int OFFLINE
public static final int STOPPING
public DiscoveryClient() throws IOException
public void initCmf(Framework cmf,
ObjectName name,
boolean db,
ModificationList list) throws IllegalAccessException, ServiceNotFoundException, InstanceAlreadyExistException
public void deleteCmf() throws InstanceNotFoundException, IllegalAccessException, ServiceNotFoundException
public void performStart()
DiscoveryClient,
the socket joins its multicast group.
public void performStop()
DiscoveryClient,
the socket leaves its multicast group.
public boolean isActive()
AdaptorServer is active.
public Vector performFindHosts() throws CommunicationException
DiscoveryResponse contains
the host names of all agents that were discovered.
DiscoveryResponse.
public Vector performFindHosts(String SelectedHost) throws CommunicationException
DiscoveryResponder
registered in its framework is on a host.
The DiscoveryResponse only contains the host name.
DiscoveryResponse.
public Vector performFindAdaptors() throws CommunicationException
DiscoveryResponse.
public Vector performFindAdaptors(String SelectedHost) throws CommunicationException
DiscoveryResponse.
public String getClassVersion()
public String getMulticastGroup()
public void setMulticastGroup(String multicastGroup)
public int getMulticastPort()
public void setMulticastPort(int multicastPort)
public void setTimeOut(int timeOut)
DiscoveryClient waits
for discovery responses. This time is expressed in milliseconds.
The default value is 1000.
If the specified argument is negative or zero, the timeOut is
reset to 1000.
The methods performFindHosts and performFindAdaptors block until this
time elapsed.
timeOut in milliseconds.
public int getTimeOut()
timeOut in milliseconds.
public void setTimeToLiveInt(int ttl) throws IOException
DiscoveryClient.
The time-to-live is the number of 'hops' that the multicast packet is
forwarded on the network.
public void setTimeToLiveByte(byte ttl) throws IOException
public byte getTimeToLiveByte()
public int getTimeToLiveInt()
public boolean getPointToPointResponse()
public void setPointToPointResponse(boolean pointToPointResponse)
pointToPointResponse - The datagram socket mode.
false value unsets the use of unicast socket for the response,
multicast is used instead.
public Integer getState()
DiscoveryResponder.
ONLINE, OFFLINE or STOPPING.
public String getStateString()
DiscoveryResponder in string form.
All Packages Class Hierarchy This Package Previous Next Index