internal override void EnterState(InternalEnlistment enlistment) { bool flag = false; enlistment.State = this; Monitor.Exit(enlistment.Transaction); try { if (DiagnosticTrace.Verbose) { EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.EnlistmentTraceId, NotificationCall.SinglePhaseCommit); } if (enlistment.SinglePhaseNotification != null) { enlistment.SinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment); } else { enlistment.PromotableSinglePhaseNotification.SinglePhaseCommit(enlistment.SinglePhaseEnlistment); } flag = true; } finally { if (!flag) { enlistment.SinglePhaseEnlistment.InDoubt(); } Monitor.Enter(enlistment.Transaction); } }
internal override void EnterState(InternalEnlistment enlistment) { // Set the enlistment state enlistment.State = this; Monitor.Exit(enlistment.Transaction); try { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.EnlistmentStatus(enlistment, NotificationCall.Rollback); } // Send the Rollback notification to the enlistment if (enlistment.SinglePhaseNotification != null) { enlistment.SinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment); } else { enlistment.PromotableSinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment); } } finally { Monitor.Enter(enlistment.Transaction); } }
internal override void Aborted(InternalEnlistment enlistment, Exception e) { if (enlistment.Transaction.innerException == null) { enlistment.Transaction.innerException = e; } DurableEnlistmentState._DurableEnlistmentEnded.EnterState(enlistment); }
internal override void EnlistmentDone(InternalEnlistment enlistment) { // End this enlistment VolatileEnlistmentDone.EnterState(enlistment); // Note another enlistment finished. enlistment.FinishEnlistment(); }
internal override void Aborted(InternalEnlistment enlistment, Exception e) { DurableEnlistmentState._DurableEnlistmentEnded.EnterState(enlistment); if (enlistment.Transaction.innerException == null) { enlistment.Transaction.innerException = e; } enlistment.Transaction.State.ChangeStatePromotedAborted(enlistment.Transaction); }
internal override void InDoubt(InternalEnlistment enlistment, Exception e) { VolatileEnlistmentState._VolatileEnlistmentEnded.EnterState(enlistment); if (enlistment.Transaction.innerException == null) { enlistment.Transaction.innerException = e; } enlistment.Transaction.State.InDoubtFromEnlistment(enlistment.Transaction); }
internal override void ForceRollback(InternalEnlistment enlistment, Exception e) { VolatileEnlistmentState._VolatileEnlistmentEnded.EnterState(enlistment); if (enlistment.Transaction.innerException == null) { enlistment.Transaction.innerException = e; } enlistment.FinishEnlistment(); }
internal override void Aborted(InternalEnlistment enlistment, Exception e) { if (enlistment.Transaction._innerException == null) { enlistment.Transaction._innerException = e; } // Transition to the ended state DurableEnlistmentEnded.EnterState(enlistment); }
internal override void ForceRollback(InternalEnlistment enlistment, Exception e) { Monitor.Exit(enlistment.SyncRoot); try { enlistment.PromotedEnlistment.ForceRollback(e); } finally { Monitor.Enter(enlistment.SyncRoot); } }
internal override void Aborted(InternalEnlistment enlistment, Exception e) { Monitor.Exit(enlistment.SyncRoot); try { enlistment.PromotedEnlistment.Aborted(e); } finally { Monitor.Enter(enlistment.SyncRoot); } }
internal override void Prepared(InternalEnlistment enlistment) { Monitor.Exit(enlistment.SyncRoot); try { enlistment.PromotedEnlistment.Prepared(); } finally { Monitor.Enter(enlistment.SyncRoot); } }
protected void AddVolatileEnlistment(ref VolatileEnlistmentSet enlistments, Enlistment enlistment) { if (enlistments.volatileEnlistmentCount == enlistments.volatileEnlistmentSize) { InternalEnlistment[] destinationArray = new InternalEnlistment[enlistments.volatileEnlistmentSize + 8]; if (enlistments.volatileEnlistmentSize > 0) { Array.Copy(enlistments.volatileEnlistments, destinationArray, enlistments.volatileEnlistmentSize); } enlistments.volatileEnlistmentSize += 8; enlistments.volatileEnlistments = destinationArray; } enlistments.volatileEnlistments[enlistments.volatileEnlistmentCount] = enlistment.InternalEnlistment; enlistments.volatileEnlistmentCount++; VolatileEnlistmentState._VolatileEnlistmentActive.EnterState(enlistments.volatileEnlistments[enlistments.volatileEnlistmentCount - 1]); }
internal Enlistment( Guid resourceManagerIdentifier, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction) { _internalEnlistment = new DurableInternalEnlistment( this, resourceManagerIdentifier, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); }
internal override void EnterState(InternalEnlistment enlistment) { enlistment.State = this; Monitor.Exit(enlistment.Transaction); try { if (DiagnosticTrace.Verbose) { EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.EnlistmentTraceId, NotificationCall.Prepare); } enlistment.EnlistmentNotification.Prepare(enlistment.PreparingEnlistment); } finally { Monitor.Enter(enlistment.Transaction); } }
internal override void EnterState(InternalEnlistment enlistment) { // Set the enlistment state enlistment.State = this; Monitor.Exit(enlistment.Transaction); try // Don't hold this lock while calling into the application code. { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.EnlistmentStatus(enlistment, NotificationCall.Rollback); } enlistment.EnlistmentNotification.Rollback(enlistment.SinglePhaseEnlistment); } finally { Monitor.Enter(enlistment.Transaction); } }
internal override void EnterState(InternalEnlistment enlistment) { enlistment.State = this; Monitor.Exit(enlistment.Transaction); try { if (DiagnosticTrace.Verbose) { EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.EnlistmentTraceId, NotificationCall.Rollback); } if (enlistment.SinglePhaseNotification != null) { enlistment.SinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment); } else { enlistment.PromotableSinglePhaseNotification.Rollback(enlistment.SinglePhaseEnlistment); } } finally { Monitor.Enter(enlistment.Transaction); } }
internal PreparingEnlistment(InternalEnlistment enlistment) : base(enlistment) { }
internal override void ChangeStateCommitting(InternalEnlistment enlistment) { // Transition to the committing state DurableEnlistmentCommitting.EnterState(enlistment); }
internal override void Committed(InternalEnlistment enlistment) { VolatileEnlistmentEnded.EnterState(enlistment); Debug.Assert(enlistment.Transaction.State != null); enlistment.Transaction.State.ChangeStateTransactionCommitted(enlistment.Transaction); }
internal virtual void Committed(InternalEnlistment enlistment) { throw TransactionException.CreateEnlistmentStateException(SR.GetString(SR.TraceSourceLtm), null); }
internal override void EnlistmentDone(InternalEnlistment enlistment) { VolatileEnlistmentState._VolatileEnlistmentEnded.EnterState(enlistment); }
internal virtual void InDoubt(InternalEnlistment enlistment, Exception e) { throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId); }
internal virtual void ChangeStateSinglePhaseCommit(InternalEnlistment enlistment) { Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", GetType())); throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId); }
internal Enlistment( InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction, EnlistmentOptions enlistmentOptions ) { if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0) { this.internalEnlistment = new InternalEnlistment( this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); } else { this.internalEnlistment = new Phase1VolatileEnlistment( this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); } }
internal Enlistment( IEnlistmentNotification twoPhaseNotifications, InternalTransaction transaction, Transaction atomicTransaction ) { this.internalEnlistment = new InternalEnlistment( this, twoPhaseNotifications, transaction, atomicTransaction ); }
internal override void ChangeStatePreparing(InternalEnlistment enlistment) { // This would happen in the second pass of a phase 0 wave. }
internal override void ChangeStateSinglePhaseCommit(InternalEnlistment enlistment) { VolatileEnlistmentSPC.EnterState(enlistment); }
internal override void InternalIndoubt(InternalEnlistment enlistment) { // Change the enlistment state to InDoubt. VolatileEnlistmentInDoubt.EnterState(enlistment); }
internal override void InternalCommitted(InternalEnlistment enlistment) { VolatileEnlistmentCommitting.EnterState(enlistment); }
internal override void InternalAborted(InternalEnlistment enlistment) { VolatileEnlistmentAborting.EnterState(enlistment); }
internal override void EnterState(InternalEnlistment enlistment) { enlistment.State = this; }
internal override void ChangeStatePreparing(InternalEnlistment enlistment) { VolatileEnlistmentPreparing.EnterState(enlistment); }
internal abstract void EnterState(InternalEnlistment enlistment);
internal void EnlistmentCommitted(InternalEnlistment enlistment) { Debug.Assert(enlistment != null, "Enlistment needed for the ETW event."); if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS)) { EnlistmentCommitted( enlistment.EnlistmentTraceId.EnlistmentIdentifier); } }
internal virtual byte[] RecoveryInformation(InternalEnlistment enlistment) { throw TransactionException.CreateEnlistmentStateException(null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId); }
internal override void ChangeStateSinglePhaseCommit(InternalEnlistment enlistment) { VolatileEnlistmentState._VolatileEnlistmentSPC.EnterState(enlistment); }
internal virtual void InDoubt(InternalEnlistment enlistment, Exception e) { throw TransactionException.CreateEnlistmentStateException(SR.GetString(SR.TraceSourceLtm), null); }
internal virtual void ChangeStateSinglePhaseCommit(InternalEnlistment enlistment) { Debug.Assert(false, string.Format(null, "Invalid Event for InternalEnlistment State; Current State: {0}", this.GetType())); throw TransactionException.CreateEnlistmentStateException(SR.GetString(SR.TraceSourceLtm), null); }
internal override void ChangeStatePreparing(InternalEnlistment enlistment) { VolatileEnlistmentState._VolatileEnlistmentPreparing.EnterState(enlistment); }
internal override void ChangeStateDelegated(InternalEnlistment enlistment) { // This is a valid state transition. DurableEnlistmentDelegated.EnterState(enlistment); }
internal virtual byte[] RecoveryInformation(InternalEnlistment enlistment) { throw TransactionException.CreateEnlistmentStateException(SR.GetString(SR.TraceSourceLtm), null); }
internal override void EnterState(InternalEnlistment enlistment) { // Set the enlistment state enlistment.State = this; }
internal override void InternalAborted(InternalEnlistment enlistment) { // Change the enlistment state to aborting. VolatileEnlistmentAborting.EnterState(enlistment); }
internal Enlistment( InternalEnlistment internalEnlistment ) { this.internalEnlistment = internalEnlistment; }
internal override void InternalAborted(InternalEnlistment enlistment) { // If this event comes from multiple places just ignore it. Continue // waiting for the enlistment to respond so that we can respond to it. }
// This constructor is for a promotable single phase enlistment. internal Enlistment( InternalTransaction transaction, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction ) { this.internalEnlistment = new PromotableInternalEnlistment( this, transaction, promotableSinglePhaseNotification, atomicTransaction ); }
internal override void InternalAborted(InternalEnlistment enlistment) { // Already working on it. }
internal Enlistment( IEnlistmentNotification twoPhaseNotifications, object syncRoot ) { this.internalEnlistment = new RecoveringInternalEnlistment( this, twoPhaseNotifications, syncRoot ); }
internal override void EnlistmentDone(InternalEnlistment enlistment) { // Move this enlistment to the ended state VolatileEnlistmentEnded.EnterState(enlistment); }
internal void EnlistmentStatus(InternalEnlistment enlistment, NotificationCall notificationCall) { Debug.Assert(enlistment != null, "Enlistment needed for the ETW event."); if (IsEnabled(EventLevel.Verbose, ALL_KEYWORDS)) { EnlistmentStatus(enlistment.EnlistmentTraceId.EnlistmentIdentifier, notificationCall.ToString()); } }
internal override void ChangeStatePreparing(InternalEnlistment enlistment) { // This enlistment was told to abort before being told to prepare }
internal void EnlistmentInDoubt(InternalEnlistment enlistment) { Debug.Assert(enlistment != null, "Enlistment needed for the ETW event."); if (IsEnabled(EventLevel.Warning, ALL_KEYWORDS)) { EnlistmentInDoubt( enlistment.EnlistmentTraceId.EnlistmentIdentifier); } }
internal override void InternalCommitted(InternalEnlistment enlistment) { // Ignore this in case the enlistment gets here before // the transaction tells it to do so }
internal override void EnlistmentDone(InternalEnlistment enlistment) { VolatileEnlistmentState._VolatileEnlistmentDone.EnterState(enlistment); enlistment.FinishEnlistment(); }
internal override void InDoubt(InternalEnlistment enlistment, Exception?e) { // Ignore this in case the enlistment gets here before // the transaction tells it to do so }
internal override void InternalAborted(InternalEnlistment enlistment) { VolatileEnlistmentState._VolatileEnlistmentAborting.EnterState(enlistment); }
internal override void ChangeStatePreparing(InternalEnlistment enlistment) { enlistment.CheckComplete(); }
internal PreparingEnlistment( InternalEnlistment enlistment ) : base(enlistment) { }
// Override of get_RecoveryInformation to be more specific with the exception string. internal override byte[] RecoveryInformation(InternalEnlistment enlistment) { throw TransactionException.CreateInvalidOperationException(TraceSourceType.TraceSourceLtm, SR.VolEnlistNoRecoveryInfo, null, enlistment == null ? Guid.Empty : enlistment.DistributedTxId); }