|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroupmgmt.impl.BeaconSender
The BeaconSender class; Responsible for periodically multicasting MemberBeacons. Controlled by the BeaconServer.
Based on the beacon package by Ali Hazemi.
BeaconServer
Field Summary | |
private MemberBeacon |
beacon
The MemberBeacon to broadcast. |
private java.net.DatagramSocket |
dgramSocket
The DatagramSocket to send beacons with. |
private java.net.InetAddress |
mcastAddress
The multicast address to send beacons to. |
private int |
mcastPort
The multicast port to send beacons to. |
private int |
period
The period to wait between broadcasts (ms). |
private java.lang.Thread |
senderThread
Thread to do the sending. |
Constructor Summary | |
BeaconSender(java.net.InetAddress mcastAddress,
int mcastPort)
Construct a BeaconSender. |
Method Summary | |
MemberBeacon |
getBeacon()
Accessor to the beacon. |
private void |
log(java.lang.String msg)
For testing. |
void |
run()
Run the BeaconSender thread. |
void |
sendBeacon()
The method that sends the beacon. |
void |
setBeacon(MemberBeacon beacon)
Set the beacon to be broadcasted. |
void |
setPeriod(int period)
Set the period at which the beacon is broadcasted. |
void |
start()
Start sending beacons. |
void |
stop()
Stop sending beacons. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.net.InetAddress mcastAddress
private int mcastPort
private java.net.DatagramSocket dgramSocket
private volatile java.lang.Thread senderThread
private MemberBeacon beacon
private int period
Constructor Detail |
public BeaconSender(java.net.InetAddress mcastAddress, int mcastPort)
mcastAddress
- The multicast address to beacon to.mcastPort
- The port to beacon to.Method Detail |
public void start()
public void stop()
public void setPeriod(int period)
period
- How often to send the beacon (ms).public void setBeacon(MemberBeacon beacon)
beacon
- The MemberBeacon to broadcast.public MemberBeacon getBeacon()
public void run()
run
in interface java.lang.Runnable
public void sendBeacon()
private void log(java.lang.String msg)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |