Exemplo n.º 1
0
        public void Aborted(Exception e)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                               "SinglePhaseEnlistment.Aborted"
                                               );
            }

            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                                            this.internalEnlistment.EnlistmentTraceId,
                                                            EnlistmentCallback.Aborted
                                                            );
            }

            lock (this.internalEnlistment.SyncRoot)
            {
                this.internalEnlistment.State.Aborted(this.internalEnlistment, e);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                              "SinglePhaseEnlistment.Aborted"
                                              );
            }
        }
Exemplo n.º 2
0
        public void ForceRollback(Exception e)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                               "PreparingEnlistment.ForceRollback"
                                               );
            }

            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                                            this.internalEnlistment.EnlistmentTraceId,
                                                            EnlistmentCallback.ForceRollback
                                                            );
            }

            lock (this.internalEnlistment.SyncRoot)
            {
                this.internalEnlistment.State.ForceRollback(this.internalEnlistment, e);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                              "PreparingEnlistment.ForceRollback"
                                              );
            }
        }
Exemplo n.º 3
0
        public void InDoubt()
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                               "SinglePhaseEnlistment.InDoubt"
                                               );
            }


            lock (this.internalEnlistment.SyncRoot)
            {
                if (DiagnosticTrace.Warning)
                {
                    EnlistmentCallbackNegativeTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                                                this.internalEnlistment.EnlistmentTraceId,
                                                                EnlistmentCallback.InDoubt
                                                                );
                }

                this.internalEnlistment.State.InDoubt(this.internalEnlistment, null);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                                              "SinglePhaseEnlistment.InDoubt"
                                              );
            }
        }
        public void InDoubt(Exception e)
        {
            IEnlistmentShim enlistmentShim = null;

            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxSinglePhaseEnlistment.InDoubt");
            }
            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, EnlistmentCallback.InDoubt);
            }
            lock (this)
            {
                if (!this.isSinglePhase || (OletxEnlistmentState.SinglePhaseCommitting != this.state))
                {
                    throw TransactionException.CreateEnlistmentStateException(System.Transactions.SR.GetString("TraceSourceOletx"), null);
                }
                this.state     = OletxEnlistmentState.InDoubt;
                enlistmentShim = this.EnlistmentShim;
            }
            lock (base.oletxTransaction.realOletxTransaction)
            {
                if (base.oletxTransaction.realOletxTransaction.innerException == null)
                {
                    base.oletxTransaction.realOletxTransaction.innerException = e;
                }
            }
            try
            {
                if (enlistmentShim != null)
                {
                    enlistmentShim.PrepareRequestDone(OletxPrepareVoteType.InDoubt);
                }
            }
            catch (COMException exception)
            {
                if ((System.Transactions.Oletx.NativeMethods.XACT_E_CONNECTION_DOWN != exception.ErrorCode) && (System.Transactions.Oletx.NativeMethods.XACT_E_TMNOTAVAILABLE != exception.ErrorCode))
                {
                    throw;
                }
                if (DiagnosticTrace.Verbose)
                {
                    ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), exception);
                }
            }
            finally
            {
                this.FinishEnlistment();
            }
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxSinglePhaseEnlistment.InDoubt");
            }
        }
 public void ForceRollback()
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "PreparingEnlistment.ForceRollback");
     }
     if (DiagnosticTrace.Warning)
     {
         EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), base.internalEnlistment.EnlistmentTraceId, EnlistmentCallback.ForceRollback);
     }
     lock (base.internalEnlistment.SyncRoot)
     {
         base.internalEnlistment.State.ForceRollback(base.internalEnlistment, null);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "PreparingEnlistment.ForceRollback");
     }
 }
 public void InDoubt(Exception e)
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "SinglePhaseEnlistment.InDoubt");
     }
     lock (base.internalEnlistment.SyncRoot)
     {
         if (DiagnosticTrace.Warning)
         {
             EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), base.internalEnlistment.EnlistmentTraceId, EnlistmentCallback.InDoubt);
         }
         base.internalEnlistment.State.InDoubt(base.internalEnlistment, e);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "SinglePhaseEnlistment.InDoubt");
     }
 }
 public void Aborted()
 {
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "SinglePhaseEnlistment.Aborted");
     }
     if (DiagnosticTrace.Warning)
     {
         EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), base.internalEnlistment.EnlistmentTraceId, EnlistmentCallback.Aborted);
     }
     lock (base.internalEnlistment.SyncRoot)
     {
         base.internalEnlistment.State.Aborted(base.internalEnlistment, null);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "SinglePhaseEnlistment.Aborted");
     }
 }
Exemplo n.º 8
0
        public void ForceRollback()
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "PreparingEnlistment.ForceRollback");
            }

            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(SR.TraceSourceLtm,
                                                            _internalEnlistment.EnlistmentTraceId, EnlistmentCallback.ForceRollback);
            }

            lock (_internalEnlistment.SyncRoot)
            {
                _internalEnlistment.State.ForceRollback(_internalEnlistment, null);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "PreparingEnlistment.ForceRollback");
            }
        }
Exemplo n.º 9
0
        public void Aborted()
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "SinglePhaseEnlistment.Aborted");
            }

            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(SR.TraceSourceLtm,
                                                            _internalEnlistment.EnlistmentTraceId, EnlistmentCallback.Aborted);
            }

            lock (_internalEnlistment.SyncRoot)
            {
                _internalEnlistment.State.Aborted(_internalEnlistment, null);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "SinglePhaseEnlistment.Aborted");
            }
        }
Exemplo n.º 10
0
        public void InDoubt(Exception e)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "SinglePhaseEnlistment.InDoubt");
            }

            lock (_internalEnlistment.SyncRoot)
            {
                if (DiagnosticTrace.Warning)
                {
                    EnlistmentCallbackNegativeTraceRecord.Trace(SR.TraceSourceLtm,
                                                                _internalEnlistment.EnlistmentTraceId, EnlistmentCallback.InDoubt);
                }

                _internalEnlistment.State.InDoubt(_internalEnlistment, e);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "SinglePhaseEnlistment.InDoubt");
            }
        }
Exemplo n.º 11
0
        void IPromotedEnlistment.ForceRollback(Exception e)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxPreparingEnlistment.ForceRollback");
            }
            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, EnlistmentCallback.ForceRollback);
            }
            OletxVolatileEnlistmentContainer container = null;

            lock (this)
            {
                if (OletxVolatileEnlistmentState.Preparing != this.state)
                {
                    throw TransactionException.CreateEnlistmentStateException(System.Transactions.SR.GetString("TraceSourceOletx"), null);
                }
                this.state = OletxVolatileEnlistmentState.Done;
                if (this.container == null)
                {
                    if (DiagnosticTrace.Critical)
                    {
                        InternalErrorTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "");
                    }
                    throw new InvalidOperationException(System.Transactions.SR.GetString("InternalError"));
                }
                container = this.container;
            }
            Interlocked.CompareExchange <Exception>(ref base.oletxTransaction.realOletxTransaction.innerException, e, null);
            container.DecrementOutstandingNotifications(false);
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxPreparingEnlistment.ForceRollback");
            }
        }
        public void ForceRollback(Exception e)
        {
            IPhase0EnlistmentShim shim           = null;
            IEnlistmentShim       enlistmentShim = null;

            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxPreparingEnlistment.ForceRollback");
            }
            if (DiagnosticTrace.Warning)
            {
                EnlistmentCallbackNegativeTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, EnlistmentCallback.ForceRollback);
            }
            lock (this)
            {
                if (OletxEnlistmentState.Preparing == this.state)
                {
                    enlistmentShim = this.EnlistmentShim;
                }
                else
                {
                    if (OletxEnlistmentState.Phase0Preparing != this.state)
                    {
                        throw TransactionException.CreateEnlistmentStateException(System.Transactions.SR.GetString("TraceSourceOletx"), null);
                    }
                    shim = this.Phase0EnlistmentShim;
                    if (shim != null)
                    {
                        base.oletxTransaction.realOletxTransaction.DecrementUndecidedEnlistments();
                    }
                }
                this.state = OletxEnlistmentState.Aborted;
            }
            Interlocked.CompareExchange <Exception>(ref base.oletxTransaction.realOletxTransaction.innerException, e, null);
            try
            {
                if (enlistmentShim != null)
                {
                    try
                    {
                        enlistmentShim.PrepareRequestDone(OletxPrepareVoteType.Failed);
                    }
                    finally
                    {
                        HandleTable.FreeHandle(this.phase1Handle);
                    }
                }
                if (shim != null)
                {
                    shim.Phase0Done(false);
                }
            }
            catch (COMException exception)
            {
                if ((System.Transactions.Oletx.NativeMethods.XACT_E_CONNECTION_DOWN != exception.ErrorCode) && (System.Transactions.Oletx.NativeMethods.XACT_E_TMNOTAVAILABLE != exception.ErrorCode))
                {
                    throw;
                }
                if (DiagnosticTrace.Verbose)
                {
                    ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), exception);
                }
            }
            finally
            {
                this.FinishEnlistment();
            }
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxPreparingEnlistment.ForceRollback");
            }
        }