public final class TOMLayer extends java.lang.Thread implements RequestReceiver
Modifier and Type | Field and Description |
---|---|
Acceptor |
acceptor |
ClientsManager |
clientsManager
Store requests received but still not ordered
|
ServerViewController |
controller |
ExecutionManager |
execManager |
LeaderModule |
lm |
RequestsTimer |
requestsTimer
Manage timers for pending requests
|
Constructor and Description |
---|
TOMLayer(ExecutionManager manager,
ServiceReplica receiver,
Recoverable recoverer,
LeaderModule lm,
Acceptor a,
ServerCommunicationSystem cs,
ServerViewController controller)
Creates a new instance of TOMulticastLayer
|
Modifier and Type | Method and Description |
---|---|
TOMMessage[] |
checkProposedValue(byte[] proposedValue,
boolean addToClientManager)
Verify if the value being proposed for a round is valid.
|
byte[] |
computeHash(byte[] data)
Computes an hash for a TOM message
|
void |
decided(Consensus cons)
Called by the current consensus's execution, to notify the TOM layer that a value was decided
|
void |
deliverTimeoutRequest(LCMessage msg)
This method is called by the MessageHandler each time it received messages related
to the leader change
|
void |
forwardRequestToLeader(TOMMessage request) |
ServerCommunicationSystem |
getCommunication()
Retrieve Communication system between replicas
|
int |
getInExec()
Gets the ID of the consensus currently beign executed
|
int |
getLastExec()
Gets the ID of the consensus which was established as the last executed
|
LCManager |
getLCManager() |
StateManager |
getStateManager() |
void |
imAmTheLeader() |
boolean |
isRetrievingState() |
void |
processOutOfContext() |
void |
requestReceived(TOMMessage msg)
This method is invoked by the communication system to deliver a request.
|
void |
resumeLC() |
void |
run()
This is the main code for this thread.
|
void |
setInExec(int inEx)
Sets which consensus is being executed at the moment
|
void |
setLastExec(int last)
Sets which consensus was the last to be executed
|
void |
setNoExec() |
java.security.SignedObject |
sign(java.io.Serializable obj) |
void |
triggerTimeout(java.util.List<TOMMessage> requestList)
This method is called when there is a timeout and the request has already been forwarded to the leader
|
boolean |
verifySignature(java.security.SignedObject so,
int sender)
Verifies the signature of a signed object
|
void |
waitForPaxosToFinish()
This method blocks until the PaW algorithm is finished
|
activeCount, checkAccess, clone, 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
public ExecutionManager execManager
public LeaderModule lm
public Acceptor acceptor
public RequestsTimer requestsTimer
public ClientsManager clientsManager
public ServerViewController controller
public TOMLayer(ExecutionManager manager, ServiceReplica receiver, Recoverable recoverer, LeaderModule lm, Acceptor a, ServerCommunicationSystem cs, ServerViewController controller)
manager
- Execution managerreceiver
- Object that receives requests from clientslm
- Leader modulea
- Acceptor role of the PaW algorithmcs
- Communication system between replicascontroller
- Reconfiguration Managerpublic final byte[] computeHash(byte[] data)
data
- Data from which to generate the hashpublic java.security.SignedObject sign(java.io.Serializable obj)
public boolean verifySignature(java.security.SignedObject so, int sender)
so
- Signed object to be verifiedsender
- Replica id that supposedly signed this objectpublic ServerCommunicationSystem getCommunication()
public void imAmTheLeader()
public void setLastExec(int last)
last
- ID of the consensus which was last to be executedpublic int getLastExec()
public void setInExec(int inEx)
inEx
- ID of the consensus being executed at the momentpublic void waitForPaxosToFinish()
public int getInExec()
public void requestReceived(TOMMessage msg)
requestReceived
in interface RequestReceiver
msg
- The request being receivedpublic void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void decided(Consensus cons)
cons
- The decided consensuspublic TOMMessage[] checkProposedValue(byte[] proposedValue, boolean addToClientManager)
proposedValue
- the value being proposedpublic void forwardRequestToLeader(TOMMessage request)
public boolean isRetrievingState()
public void setNoExec()
public void processOutOfContext()
public StateManager getStateManager()
public LCManager getLCManager()
public void triggerTimeout(java.util.List<TOMMessage> requestList)
requestList
- List of requests that the replica wanted to order but didn't manage topublic void deliverTimeoutRequest(LCMessage msg)
msg
- Message received from the other replicapublic void resumeLC()