public IResponse VisitStartViewChangeXL(StartViewChangeXL startViewChange) { if (this.replicaState.HandlerStateChanged.WaitOne(Timeout.TIMEOUT_VIEW_CHANGE) && this.replicaState.State is ViewChangeMessageProcessor) { return(startViewChange.Accept(this.replicaState.State)); } return(null); }
public IResponse VisitStartViewChangeXL(StartViewChangeXL startViewChange) { if (startViewChange.ViewNumber <= this.replicaState.ViewNumber) { return(null); } if (startViewChange.ViewNumber == this.viewNumber && ConfigurationUtils.CompareConfigurations(startViewChange.Configuration, this.configuration)) { return(new StartViewChangeXLOk(this.replicaState.ServerId, this.viewNumber, this.configuration)); } Log.Debug("Received Start View Change that don't match."); return(null); }
private void MulticastStartViewChange() { IMessage message = new StartViewChangeXL(this.replicaState.ServerId, this.viewNumber, this.configuration); Uri[] currentConfiguration = this.replicaState.ReplicasUrl.ToArray(); IResponses responses = this.messageServiceClient.RequestMulticast( message, currentConfiguration, this.replicaState.Configuration.Count / 2, Timeout.TIMEOUT_VIEW_CHANGE, true); IResponse[] responsesVector = responses.ToArray(); // There was no quorum to accept the view change if (responsesVector.Length < this.numberToWait) { Log.Debug($"There was no quorum for view change. " + $"Just received {responsesVector.Length} from at least {this.numberToWait}"); this.replicaState.ChangeToNormalState(); return; } // In case I'm the manager, wait for f DoViewChange if (this.imTheManager) { this.CheckNumberAndSetNewConfiguration(); } else { // Else, send DoViewChange to leader Uri leader = this.configuration.Values.ToArray()[0]; IMessage doViewMessage = new DoViewChangeXL( this.replicaState.ServerId, this.viewNumber, this.replicaState.ViewNumber, this.configuration, this.replicaState.TupleSpace, this.replicaState.ClientTable, this.replicaState.CommitNumber); this.messageServiceClient.Request(doViewMessage, leader, -1); } }
public IResponse VisitStartViewChangeXL(StartViewChangeXL startViewChange) { return(this.WaitNormalState(startViewChange)); }