universal.leader
Class LeaderCrashStopServer
java.lang.Object
|
+--universal.leader.Leader
|
+--universal.leader.LeaderCrashStopServer
- All Implemented Interfaces:
- java.lang.Runnable
- public class LeaderCrashStopServer
- extends Leader
This is the implementation of the leader part of the algorithm in the server side.
As it is now it can be use also for the crash recovery model without big changes.
Fields inherited from class universal.leader.Leader |
uni |
Method Summary |
void |
initialize(boolean recovering)
Create one object trustlist per replicated server.
|
int |
is_leader()
Returns first correct replicated server alive in the list.
|
void |
omega()
Sends periodically AmAliveMessage to all the others replicated server and also to the client.
|
void |
receivedAmAlive(universal.AmAliveMessage m)
Call when it receives an AmAliveMessage from one of the replicated servers.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
trustList
public LeaderCrashStopServer.trustListElement[] trustList
- trustList[k] contains information about the replicated server of pid k
LeaderCrashStopServer
public LeaderCrashStopServer(universal.Universal uni)
initialize
public void initialize(boolean recovering)
- Create one object trustlist per replicated server.
Starts the thread.
is_leader
public int is_leader()
- Returns first correct replicated server alive in the list.
As we are in the server side the function is_leader will return the pid of the leader.
A replicated server always trust himself
- Specified by:
is_leader
in class Leader
omega
public void omega()
- Sends periodically AmAliveMessage to all the others replicated server and also to the client.
Check if some replicated server shouldn't be trusted anymore because we don't have receive any
AmAlive message from it since a period of length delta.
- Specified by:
omega
in class Leader
receivedAmAlive
public void receivedAmAlive(universal.AmAliveMessage m)
- Call when it receives an AmAliveMessage from one of the replicated servers.
If this replicated servers wasn't trusted as alive it is again trusted and we
increase the period delta to check if it has received a message or not.
- Specified by:
receivedAmAlive
in class Leader