Beispiel #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>
        public bool Commit(int tid, List <int> usedPadInts)
        {
            Logger.Log(new String[] { "Server", ID.ToString(), "commit", "tid", tid.ToString(), serverState.StateMsg });

            try {
                return(serverState.Commit(tid, usedPadInts));
            }
            catch (PadIntNotFoundException) {
                throw;
            }
            catch (ServerDoesNotReplyException) {
                throw;
            }
        }
Beispiel #2
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[] { "FreezedServer", Server.ID.ToString(), "commit", "tid", tid.ToString() });
            bool result;

            lock (this) {
                while (!recover)
                {
                    Monitor.Wait(this);
                }
                result = oldState.Commit(tid, usedPadInts);
                Monitor.Pulse(this);
            }
            return(result);
        }