コード例 #1
0
        internal void VoteRequest()
        {
            OletxVolatileEnlistment enlistment = null;
            int  count = 0;
            bool flag  = false;

            lock (this)
            {
                if (DiagnosticTrace.Verbose)
                {
                    string methodName = "OletxPhase1VolatileEnlistmentContainer.VoteRequest";
                    MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), methodName);
                }
                base.phase = 1;
                if (0 < base.incompleteDependentClones)
                {
                    flag = true;
                    base.outstandingNotifications = 1;
                }
                else
                {
                    base.outstandingNotifications = base.enlistmentList.Count;
                    count = base.enlistmentList.Count;
                    if (count == 0)
                    {
                        base.outstandingNotifications = 1;
                    }
                }
                base.realOletxTransaction.TooLateForEnlistments = true;
            }
            if (flag)
            {
                this.DecrementOutstandingNotifications(false);
            }
            else if (count == 0)
            {
                this.DecrementOutstandingNotifications(true);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    enlistment = base.enlistmentList[i] as OletxVolatileEnlistment;
                    if (enlistment == null)
                    {
                        if (DiagnosticTrace.Critical)
                        {
                            InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "");
                        }
                        throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
                    }
                    enlistment.Prepare(this);
                }
            }
            if (DiagnosticTrace.Verbose)
            {
                string str = "OletxPhase1VolatileEnlistmentContainer.VoteRequest";
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), str);
            }
        }
コード例 #2
0
        internal void Phase0Request(bool abortHint)
        {
            OletxVolatileEnlistment enlistment = null;
            int count = 0;
            OletxCommittableTransaction committableTransaction = null;
            bool flag = false;

            lock (this)
            {
                if (DiagnosticTrace.Verbose)
                {
                    string methodName = "OletxPhase0VolatileEnlistmentContainer.Phase0Request, abortHint = " + abortHint.ToString(CultureInfo.CurrentCulture) + ", phase = " + this.phase.ToString(CultureInfo.CurrentCulture);
                    MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), methodName);
                }
                this.aborting          = abortHint;
                committableTransaction = base.realOletxTransaction.committableTransaction;
                if ((committableTransaction != null) && !committableTransaction.CommitCalled)
                {
                    flag          = true;
                    this.aborting = true;
                }
                if ((2 == base.phase) || (-1 == base.phase))
                {
                    if (-1 == base.phase)
                    {
                        base.phase = 0;
                    }
                    if ((this.aborting || this.tmWentDown) || (flag || (2 == base.phase)))
                    {
                        if (this.phase0EnlistmentShim != null)
                        {
                            try
                            {
                                this.phase0EnlistmentShim.Phase0Done(false);
                                base.alreadyVoted = true;
                            }
                            catch (COMException exception)
                            {
                                if (DiagnosticTrace.Verbose)
                                {
                                    ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), exception);
                                }
                            }
                        }
                        return;
                    }
                    base.outstandingNotifications = base.enlistmentList.Count;
                    count = base.enlistmentList.Count;
                    if (count == 0)
                    {
                        base.outstandingNotifications = 1;
                    }
                }
                else
                {
                    if (DiagnosticTrace.Critical)
                    {
                        InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxPhase0VolatileEnlistmentContainer.Phase0Request, phase != -1");
                    }
                    throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
                }
            }
            if (count == 0)
            {
                this.DecrementOutstandingNotifications(true);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    enlistment = base.enlistmentList[i] as OletxVolatileEnlistment;
                    if (enlistment == null)
                    {
                        if (DiagnosticTrace.Critical)
                        {
                            InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "");
                        }
                        throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
                    }
                    enlistment.Prepare(this);
                }
            }
            if (DiagnosticTrace.Verbose)
            {
                string str = "OletxPhase0VolatileEnlistmentContainer.Phase0Request, abortHint = " + abortHint.ToString(CultureInfo.CurrentCulture);
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), str);
            }
        }