groupmgmt.impl
Class BeaconServer

java.lang.Object
  extended bygroupmgmt.impl.BeaconServer

class BeaconServer
extends java.lang.Object

The BeaconServer class; Beaconing service used for host discovery. Controls the BeaconSender and BeaconReceiver.

Based on the beacon package by Ali Hazemi.

Version:
July 2003
Author:
Christine Julien, Tom Elgin
See Also:
BeaconingDetector, SafeDistanceDetector, BeaconSender, BeaconReceiver

Field Summary
private  BeaconReceiver beaconReceiver
           
private  BeaconSender beaconSender
           
 
Constructor Summary
BeaconServer(java.net.InetAddress mcastAddress, int mcastPort, boolean receiveOwn)
          Create a BeaconServer.
 
Method Summary
 void addBeaconListener(BeaconListener beaconListener)
          Add a BeaconListener to be notified of new BeaconEvents.
 MemberBeacon getBeacon()
          Accessor to the beacon.
 void removeBeaconListener(BeaconListener beaconListener)
          Stop sending BeaconEvents to a BeaconListener.
 void sendBeaconNow()
          Send a Beacon immediately.
 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 the BeaconServer.
 void startReceiver()
          Start only the BeaconReceiver.
 void startSender()
          Start only the BeaconSender.
 void stop()
          Stop the BeaconServer.
 void stopReceiver()
          Stop only the BeaconReceiver.
 void stopSender()
          Stop only the BeaconSender.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beaconSender

private BeaconSender beaconSender

beaconReceiver

private BeaconReceiver beaconReceiver
Constructor Detail

BeaconServer

public BeaconServer(java.net.InetAddress mcastAddress,
                    int mcastPort,
                    boolean receiveOwn)
Create a BeaconServer.

Parameters:
mcastAddress - The multicast address to beacon to.
mcastPort - The port to beacon to.
receiveOwn - Whether or not the BeaconReceiver should report receiving beacons sent from this host.
Method Detail

setBeacon

public void setBeacon(MemberBeacon beacon)
Set the beacon to be broadcasted.

Parameters:
beacon - The MemberBeacon to broadcast.

getBeacon

public MemberBeacon getBeacon()
Accessor to the beacon.

Returns:
The MemberBeacon currently being broadcasted.

setPeriod

public void setPeriod(int period)
Set the period at which the beacon is broadcasted.

Parameters:
period - How often to send the beacon (ms).

startReceiver

public void startReceiver()
Start only the BeaconReceiver.


stopReceiver

public void stopReceiver()
Stop only the BeaconReceiver.


startSender

public void startSender()
Start only the BeaconSender.


stopSender

public void stopSender()
Stop only the BeaconSender.


start

public void start()
Start the BeaconServer. Starts the Receiver and the Sender.


stop

public void stop()
Stop the BeaconServer. Stops the Sender and Receiver.


sendBeaconNow

public void sendBeaconNow()
Send a Beacon immediately. This does not change the time remaining until the next beacon is normally sent.


addBeaconListener

public void addBeaconListener(BeaconListener beaconListener)
Add a BeaconListener to be notified of new BeaconEvents.

Parameters:
beaconListener - The listener to be notified.

removeBeaconListener

public void removeBeaconListener(BeaconListener beaconListener)
Stop sending BeaconEvents to a BeaconListener.