public object GetValue(Transaction transaction) { if (this.transaction != null && this.transaction == transaction) return this.value; return this.GetValue(transaction.Start - 1); }
public void RollbackValue(Transaction transaction) { lock (this.trobj) { if (this.transaction != transaction) return; this.transaction = null; this.value = null; } }
public void CommitTransaction() { lock (this) this.transactions.Remove(current); long trtime = Interlocked.Increment(ref this.time); Interlocked.Increment(ref this.time); current.Commit(trtime); current = null; }
public void BeginTransaction() { if (current != null) throw new InvalidOperationException("A Transaction is active"); Transaction transaction = this.CreateTransaction(); current = transaction; lock (this) this.transactions.Add(current); }
public void CommitValue(Transaction transaction) { lock (this.trobj) { if (this.transaction == transaction) { this.SetValue(transaction.End, this.value); this.transaction = null; this.value = null; } if (this.trobj.TransactionManager.HasTransactions()) this.ReleaseValues(this.trobj.TransactionManager.MinimalTransactionalTime); } }
public void SetValue(Transaction transaction, object value) { if (this.transaction != null && this.transaction != transaction) throw new InvalidOperationException("Another transaction modified this value"); foreach (long time in this.committedValues.Keys) if (time > transaction.Start) throw new InvalidOperationException("Another transaction modified this value"); if (this.transaction == null) transaction.RegisterValue(this); this.transaction = transaction; this.value = value; }