public IAsyncResult BeginCommit(AsyncCallback?asyncCallback, object?asyncState) { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this); etwLog.TransactionCommit(this, "CommittableTransaction"); } ObjectDisposedException.ThrowIf(Disposed, this); lock (_internalTransaction) { if (_complete) { throw TransactionException.CreateTransactionCompletedException(DistributedTxId); } Debug.Assert(_internalTransaction.State != null); // this.complete will get set to true when the transaction enters a state that is // beyond Phase0. _internalTransaction.State.BeginCommit(_internalTransaction, true, asyncCallback, asyncState); } if (etwLog.IsEnabled()) { etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this); } return(this); }
// Forward the commit to the state machine to take the appropriate action. // public void Commit() { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this); etwLog.TransactionCommit(this, "CommittableTransaction"); } if (Disposed) { throw new ObjectDisposedException(nameof(CommittableTransaction)); } lock (_internalTransaction) { if (_complete) { throw TransactionException.CreateTransactionCompletedException(DistributedTxId); } Debug.Assert(_internalTransaction.State != null); _internalTransaction.State.BeginCommit(_internalTransaction, false, null, null); // now that commit has started wait for the monitor on the transaction to know // if the transaction is done. do { if (_internalTransaction.State.IsCompleted(_internalTransaction)) { break; } } while (Monitor.Wait(_internalTransaction)); _internalTransaction.State.EndCommit(_internalTransaction); } if (etwLog.IsEnabled()) { etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this); } }
internal void BeginCommit(InternalTransaction internalTransaction) { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.MethodEnter(TraceSourceType.TraceSourceOleTx, this); etwLog.TransactionCommit(TraceSourceType.TraceSourceOleTx, TransactionTraceId, "CommittableTransaction"); } Debug.Assert(0 == Disposed, "OletxTransction object is disposed"); RealOletxTransaction.InternalTransaction = internalTransaction; _commitCalled = true; RealOletxTransaction.Commit(); if (etwLog.IsEnabled()) { etwLog.MethodExit(TraceSourceType.TraceSourceOleTx, this, $"{nameof(OletxCommittableTransaction)}.{nameof(BeginCommit)}"); } }