/// <summary> /// Returns the value of the PadInt when the transaction has the read/write lock. /// Throws an exception if PadInt not found. /// </summary> /// <param name="tid">Transaction identifier</param> /// <param name="uid">PadInt identifier</param> /// <returns></returns> internal override int ReadPadInt(int tid, int uid) { Logger.Log(new String[] { "PrimaryServer", Server.ID.ToString(), "readPadInt ", "tid", tid.ToString(), "uid", uid.ToString() }); try { /* Obtain the PadInt identified by uid */ PadInt padInt = GetPadInt(uid); while (true) { if (padInt.HasWriteLock(tid) || padInt.GetReadLock(tid)) { /* updates the backup server */ backupReplyTimer.Start(); BackupServer.ReadPadInt(tid, uid); backupReplyTimer.Stop(); return(padInt.ActualValue); } } } catch (PadIntNotFoundException) { throw; } catch (AbortException) { throw; } }
/* Returns the value of the PadInt when the transaction * has the read/write lock. * Throw an exception if PadInt not found. */ internal override int ReadPadInt(int tid, int uid) { Logger.Log(new String[] { "BackupServer", Server.ID.ToString(), "readPadInt ", "tid", tid.ToString(), "uid", uid.ToString() }); try { /* Obtain the PadInt identified by uid */ PadInt padInt = GetPadInt(uid); if (padInt.HasWriteLock(tid) || padInt.GetReadLock(tid)) { return(padInt.ActualValue); } } catch (PadIntNotFoundException) { throw; } catch (AbortException) { throw; } return(-1); }