|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.discovery.internal.comm.DiscoveryComm org.ow2.jonas.discovery.internal.comm.DiscoveryGreetingResponder
public class DiscoveryGreetingResponder
This class sends a multicast message stating the servername and the port at which it will listen for messages. It listens at the unicast port for a pre-determined time (greetingTimeOut) and if it receives a message indicating that a server with the same ID already exists in the domain then it terminates the discovery service.
Field Summary | |
---|---|
protected int |
greetingPort
Port to listen to for greeting responses. |
protected int |
greetingTimeOut
Time out period to listen to greetingPort for replies. |
protected DatagramSocket |
recvUnicastSocket
Used to recieve responses to the initial greeting message sent out on the multicast port. |
Fields inherited from class org.ow2.jonas.discovery.internal.comm.DiscoveryComm |
---|
domainName, jonasName, multicastSocket, notStopped, RECEIVE_BUFFER_SIZE, serverId, unicastSocket, urls |
Constructor Summary | |
---|---|
DiscoveryGreetingResponder(DiscoveryManager dm)
Constructs a DiscoveryGreetingResponder associated to the DiscoveryManager |
Method Summary | |
---|---|
protected DiscGreeting |
createDiscGreeting(boolean startup)
Create a discovery greeting message |
void |
handleGreeting()
Creates a new thread to send the greeting message and listens for rejection messages in response. |
void |
run()
|
void |
stop()
Throw the run time exception to state that a server with the same name already exists. |
Methods inherited from class org.ow2.jonas.discovery.internal.comm.DiscoveryComm |
---|
createNotifMessage, getDatagram, getServerId, join, sendNotif, sendResponse, setDomainName, setJonasName, setServerId, setUrls |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DatagramSocket recvUnicastSocket
protected int greetingPort
protected int greetingTimeOut
Constructor Detail |
---|
public DiscoveryGreetingResponder(DiscoveryManager dm)
dm
- DiscoveryManager to which this instance is associatedMethod Detail |
---|
protected DiscGreeting createDiscGreeting(boolean startup)
startup
- -
true: means that is a greeting message at the point of start
up of the discovery service. false: means this is a reply to
a previous greeting message.
public void run()
run
in interface Runnable
run
in class DiscoveryComm
Runnable.run()
public void handleGreeting() throws DuplicateServerNameException
DuplicateServerNameException
- - If a server with the same ID
is found in the domain.public void stop()
stop
in class DiscoveryComm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |