Example #1
0
        /// <summary>
        /// Writes a value in a PadInt
        /// </summary>
        /// <param name="tid">Transaction identifier</param>
        /// <param name="uid">PadInt identifier</param>
        /// <param name="value">Value of the write</param>
        /// <returns>True if successful</returns>
        internal override bool WritePadInt(int tid, int uid, int value)
        {
            Logger.Log(new String[] { "Server ", Server.ID.ToString(), " writePadInt ", "tid", tid.ToString(), "uid", uid.ToString(), "value", value.ToString() });

            try {
                /* Obtain the PadInt identified by uid */
                PadInt padInt = GetPadInt(uid);

                while (true)
                {
                    if (padInt.GetWriteLock(tid))
                    {
                        padInt.ActualValue = value;
                        /* updates the backup server */
                        backupReplyTimer.Start();
                        BackupServer.WritePadInt(tid, uid, value);
                        backupReplyTimer.Stop();
                        return(true);
                    }
                }
            } catch (PadIntNotFoundException) {
                throw;
            } catch (AbortException) {
                throw;
            }
        }
Example #2
0
        internal override bool WritePadInt(int tid, int uid, int value)
        {
            Logger.Log(new String[] { "Server ", Server.ID.ToString(), " writePadInt ", "tid", tid.ToString(), "uid", uid.ToString(), "value", value.ToString() });

            try {
                /* Obtain the PadInt identified by uid */
                PadInt padInt = GetPadInt(uid);

                if (padInt.GetWriteLock(tid))
                {
                    padInt.ActualValue = value;
                    return(true);
                }
            } catch (PadIntNotFoundException) {
                throw;
            } catch (AbortException) {
                throw;
            }

            return(false);
        }