service.id
Class IdentificationServer

java.lang.Object
  extended by java.lang.Thread
      extended by service.id.IdentificationServer
All Implemented Interfaces:
java.lang.Runnable

public class IdentificationServer
extends java.lang.Thread

The identification server has to started before launching any process. Its goal is to set the identifiers of the processes of the system and to make them knowing the identifiers of all the processes.

The server communicates with the processes in two ways, depending on the communication direction:


Nested Class Summary
protected  class IdentificationServer.PingManager
          The heartbreak thread send regularly an hearbreak message to each process.
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  CommunicationElement commElt
          The communication element used for sending data to processes
protected  java.net.InetAddress group
          The multicast IP group address
protected  java.util.Vector<ProcessIdentifier> identifiers
          Set of all the process identifiers of the system
protected  int lastId
          The last identifier used.
protected  java.net.MulticastSocket socket
          The UDP multicast socket that is used by a process to contact the identification server
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IdentificationServer()
           
 
Method Summary
 java.util.Vector<ProcessIdentifier> getIdentifiers()
           
protected  void initialize()
          Initialize the server by creating its multicast socket.
static void main(java.lang.String[] argv)
           
protected  void printIdentifiers()
          Print on standard output all process identifiers.
protected  IdentificationData receiveData()
          Wait for a data received on the UDP multicast group.
 void run()
           
protected  void sendAllId()
          Send all process identifiers to each process.
 void setIdentifiers(java.util.Vector<ProcessIdentifier> identifiers)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

identifiers

protected java.util.Vector<ProcessIdentifier> identifiers
Set of all the process identifiers of the system


lastId

protected int lastId
The last identifier used. Allow a unique identifier management.


commElt

protected CommunicationElement commElt
The communication element used for sending data to processes


socket

protected java.net.MulticastSocket socket
The UDP multicast socket that is used by a process to contact the identification server


group

protected java.net.InetAddress group
The multicast IP group address

Constructor Detail

IdentificationServer

public IdentificationServer()
                     throws CommunicationException
Throws:
CommunicationException
Method Detail

getIdentifiers

public java.util.Vector<ProcessIdentifier> getIdentifiers()
Returns:
the set of process identifiers

setIdentifiers

public void setIdentifiers(java.util.Vector<ProcessIdentifier> identifiers)
Parameters:
identifiers - set the process identifier set

printIdentifiers

protected void printIdentifiers()
Print on standard output all process identifiers.


sendAllId

protected void sendAllId()
Send all process identifiers to each process.


receiveData

protected IdentificationData receiveData()
Wait for a data received on the UDP multicast group.

Returns:
the received data, null in case of problem

initialize

protected void initialize()
Initialize the server by creating its multicast socket.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

main

public static void main(java.lang.String[] argv)