System.Transactions.TransactionStatePromotedBase.CompleteAbortingClone C# (CSharp) Method

CompleteAbortingClone() private method

private CompleteAbortingClone ( InternalTransaction tx ) : void
tx InternalTransaction
return void
        internal override void CompleteAbortingClone(InternalTransaction tx)
        {
            // If we have a phase1Volatile.VolatileDemux, we have a phase1 volatile enlistment
            // on the promoted transaction and it will take care of checking for incomplete aborting
            // dependent clones in its Prepare processing.
            if (null != tx._phase1Volatiles.VolatileDemux)
            {
                tx._phase1Volatiles._dependentClones--;
                Debug.Assert(tx._phase1Volatiles._dependentClones >= 0);
            }
            else
            // We need to deal with the aborting clones ourself, possibly completing the aborting
            // clone we have on the promoted transaction.
            {
                tx._abortingDependentCloneCount--;
                Debug.Assert(0 <= tx._abortingDependentCloneCount);
                if (0 == tx._abortingDependentCloneCount)
                {
                    // We need to complete our dependent clone on the promoted transaction and null it out
                    // so if we get a new one, a new one will be created on the promoted transaction.
                    DistributedDependentTransaction dtx = tx._abortingDependentClone;
                    tx._abortingDependentClone = null;

                    Monitor.Exit(tx);
                    try
                    {
                        try
                        {
                            dtx.Complete();
                        }
                        finally
                        {
                            dtx.Dispose();
                        }
                    }
                    finally
                    {
                        Monitor.Enter(tx);
                    }
                }
            }
        }