|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.net.farsight.UpdateDaemon
The update daemon communicates with the other FarSight
services
inside the local network (see Vicinity
) to synchronize the contact
lists. While it's running it will listen to a given multicast address. On
this address update packets are sent (broadcast)
and recieved.
Depending on the type of recieved packets the update daemon can add or
remove contacts to or from Farsight's contact list.
The update daemon will only run if Farsight has been started in the shared
data mode (see FarSightImpl
).
Field Summary | |
private InetAddress |
addr_
The multicast address |
private String |
hostId_
The distinguished name of the owner (certificate) of the currently running SeMoA system. |
private Map |
hosts_
A reference to the real contact map of farsight (not a copy). |
private static Logger |
log_
The Logger instance for this class |
static int |
MAX_PACKET_SIZE
The maximum supported size of datagrams. |
private int |
port_
The multicast port |
private Thread |
selfRunner_
The thread that runs the run method of this class. |
private boolean |
sharedMode_
see FarSightImpl. |
private MulticastSocket |
socket_
The MulticastSocket that is used for
listening and sending packets. |
Constructor Summary | |
UpdateDaemon(Map contacts,
boolean sharedMode,
InetAddress addr,
int port)
Sole construtor. |
Method Summary | |
void |
broadcast(UpdatePacket packet)
|
void |
broadcastAdd(String key,
String value)
broadcast add |
void |
broadcastRemove(String key)
broadcast remove |
private void |
handleAdded(UpdatePacket packet)
|
void |
handlePacket(DatagramPacket datagram)
This method handles received datagram packets. |
private void |
handleRemoved(UpdatePacket packet)
|
private void |
listen()
Listens for FarSights UpdatePackets. |
void |
run()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static Logger log_
Logger
instance for this class
private int port_
private MulticastSocket socket_
MulticastSocket
that is used for
listening and sending packets.
private InetAddress addr_
public static final int MAX_PACKET_SIZE
private boolean sharedMode_
private Map hosts_
private String hostId_
private Thread selfRunner_
Constructor Detail |
public UpdateDaemon(Map contacts, boolean sharedMode, InetAddress addr, int port) throws FileNotFoundException, IOException
contacts
- This must be the real contacts map, not just a copy.sharedMode
- See FarSightImpl
.addr
- The address that should be used for multicasting.port
- The port that should be used for multicasting.Method Detail |
public void broadcast(UpdatePacket packet) throws IOException
IOException
public void broadcastAdd(String key, String value) throws BadNameException, IOException
BadNameException
IOException
public void broadcastRemove(String key) throws BadNameException, IOException
BadNameException
IOException
public void handlePacket(DatagramPacket datagram) throws IOException, CorruptedCodeException
datagram
- The datagram packet that was received.
IOException
- if anI/O error occurs.
CorruptedCodeException
- if the packet
cannot be decoded properly.public void run()
run
in interface Runnable
private void handleAdded(UpdatePacket packet)
private void handleRemoved(UpdatePacket packet)
private void listen() throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |