示例#1
0
        /// <summary>
        /// Commits a transaction on this server
        /// </summary>
        /// <param name="tid">transaction identifier</param>
        /// <param name="usedPadInts">Identifiers of PadInts involved</param>
        /// <returns>A predicate confirming the sucess of the operations</returns>
        internal override bool Commit(int tid, List <int> usedPadInts)
        {
            Logger.Log(new String[] { "PrimaryServer", Server.ID.ToString(), "commit", "tid", tid.ToString() });

            bool resultCommit = true;

            try {
                VerifyPadInts(usedPadInts);

                foreach (int padIntUid in usedPadInts)
                {
                    PadInt padInt = GetPadInt(padIntUid);
                    resultCommit = padInt.Commit(tid) && resultCommit;
                }
            } catch (PadIntNotFoundException) {
                throw;
            }

            /* updates the backup server */
            backupReplyTimer.Start();
            BackupServer.Commit(tid, usedPadInts);
            backupReplyTimer.Stop();

            return(resultCommit);
        }