示例#1
0
        public void ExecuteAdd(AddExecutor addExecutor)
        {
            Log.Debug($"Requesting Add({addExecutor.Tuple}) to Tuple Space.");
            this.replicaState.TupleSpace.Add(addExecutor.Tuple);

            // increment commit number
            int commitNumber = this.replicaState.IncrementCommitNumber();
            int viewNumber   = this.replicaState.ViewNumber;

            ClientResponse clientResponse = new ClientResponse(commitNumber, viewNumber, string.Empty);

            // update client table
            lock (this.replicaState) {
                this.replicaState.ClientTable[addExecutor.ClientId] =
                    new Tuple <int, ClientResponse>(addExecutor.RequestNumber, clientResponse);
            }

            // Signal waiting thread that the execution is done
            addExecutor.Executed.Set();
            this.replicaState.HandlersCommits.Set();
            this.replicaState.HandlersCommits.Reset();

            // commit execution
            this.SendCommit(viewNumber, commitNumber);
        }
示例#2
0
        public void ExecuteAdd(AddExecutor addExecutor)
        {
            Log.Debug($"Requesting Add({addExecutor.Tuple}) to Tuple Space.");
            this.replicaState.TupleSpace.Add(addExecutor.Tuple);

            int viewNumber = this.replicaState.ViewNumber;

            ClientResponse clientResponse = new ClientResponse(addExecutor.RequestNumber, viewNumber, string.Empty);

            // update client table
            this.UpdateClientTable(addExecutor, clientResponse);
            this.replicaState.IncrementCommitNumber();
        }