universal
Class Universal

java.lang.Object
  |
  +--universal.Universal
Direct Known Subclasses:
UniversalCrashStop

public abstract class Universal
extends java.lang.Object

This class is the superclass of the object UniversalCrashStop which is instantiate by the server.
It can be later also used as a superclass for the crash recovery model. This class starts the thread of the class readListener, writeListener, AckListener which waits for messages for the consensus.
It finds a port free for the socket tcp to listen incomming message for the leader election and the consensus. It also instantiates the object Sender, Receiver and ReplicasAnnounce.


Field Summary
 java.net.InetAddress add
           
(package private)  java.net.InetAddress add1
           
 universal.consensus.Consensus cons
          Object for the consensus purposes
 universal.leader.Leader lead
          Object which treats the leader election
 int pid
          The pid of this server
 int port
           
 universal.communication.Receiver receiver
          Object which waits for message comming to the socket
 universal.consensus.register.Register reg
          Object for the consensus purposes
 universal.messagein.ReplicasAnnounce replicasAnnounce
          Sends Corba message to the other replicated servers to tell them in which port the TCP socket listen
 java.lang.String replicasNameFile
          The name of the file which contains the name of the others replicated server and their pid
 universal.communication.Sender sender
          Object which send message through the socket
 java.net.ServerSocket serverSocket
           
private  java.util.Date startTime
           
(package private)  java.lang.Thread t
           
 int totalDel
           
 boolean waiting
           
 
Constructor Summary
Universal(int pid, java.lang.String replicasNameFile)
          Each replicated servers has one object universal.
 
Method Summary
private static java.net.InetAddress getLocalInetAddress()
           
abstract  void initializeTasks()
           
 void initializeUniversal()
          Look for a port free to listen.
 void startTasks()
          Starts the thread ReadListenner, WriteListenner, AckListenner
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startTime

private java.util.Date startTime

totalDel

public int totalDel

lead

public universal.leader.Leader lead
Object which treats the leader election


receiver

public universal.communication.Receiver receiver
Object which waits for message comming to the socket


sender

public universal.communication.Sender sender
Object which send message through the socket


replicasAnnounce

public universal.messagein.ReplicasAnnounce replicasAnnounce
Sends Corba message to the other replicated servers to tell them in which port the TCP socket listen


add

public final java.net.InetAddress add

add1

java.net.InetAddress add1

port

public int port

waiting

public boolean waiting

serverSocket

public java.net.ServerSocket serverSocket

cons

public universal.consensus.Consensus cons
Object for the consensus purposes


reg

public universal.consensus.register.Register reg
Object for the consensus purposes


pid

public int pid
The pid of this server


replicasNameFile

public java.lang.String replicasNameFile
The name of the file which contains the name of the others replicated server and their pid


t

java.lang.Thread t
Constructor Detail

Universal

public Universal(int pid,
                 java.lang.String replicasNameFile)
Each replicated servers has one object universal.

Parameters:
pid - the pid of the replicated server.
replicasNameFile - the name of the file which contains the list of the others replicated servers
Method Detail

getLocalInetAddress

private static java.net.InetAddress getLocalInetAddress()

initializeUniversal

public void initializeUniversal()
Look for a port free to listen. Instantiate the object receiver, sender, replicaAnnounce. Call the method Announce of the object replicasAnnounce which is going to send some corba message to inform the others replicas on which ports our socket listen.


initializeTasks

public abstract void initializeTasks()

startTasks

public void startTasks()
Starts the thread ReadListenner, WriteListenner, AckListenner


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object