public Enlistment EnlistVolatile(ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "Transaction.EnlistVolatile( ISinglePhaseNotification )"); } if (this.Disposed) { throw new ObjectDisposedException("Transaction"); } if (singlePhaseNotification == null) { throw new ArgumentNullException("singlePhaseNotification"); } if ((enlistmentOptions != EnlistmentOptions.None) && (enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired)) { throw new ArgumentOutOfRangeException("enlistmentOptions"); } if (this.complete) { throw TransactionException.CreateTransactionCompletedException(System.Transactions.SR.GetString("TraceSourceLtm")); } lock (this.internalTransaction) { Enlistment enlistment2 = this.internalTransaction.State.EnlistVolatile(this.internalTransaction, singlePhaseNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "Transaction.EnlistVolatile( ISinglePhaseNotification )"); } return(enlistment2); } }
internal Enlistment( InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction, EnlistmentOptions enlistmentOptions) { if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0) { _internalEnlistment = new InternalEnlistment( this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); } else { _internalEnlistment = new Phase1VolatileEnlistment( this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); } }
public Enlistment EnlistVolatile( ISinglePhaseNotification notification, EnlistmentOptions options) { /* FIXME: Anything extra reqd for this? */ return(EnlistVolatileInternal(notification, options)); }
public Enlistment PromoteAndEnlistDurable( Guid manager, IPromotableSinglePhaseNotification promotableNotification, ISinglePhaseNotification notification, EnlistmentOptions options) { throw new NotImplementedException("DTC unsupported, multiple durable resource managers aren't supported."); }
public Phase1VolatileEnlistment( Enlistment enlistment, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction) : base(enlistment, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction) { }
public Enlistment PromoteAndEnlistDurable(Guid resourceManagerIdentifier, IPromotableSinglePhaseNotification promotableNotification, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.MethodEnter(TraceSourceType.TraceSourceDistributed, this); } if (Disposed) { throw new ObjectDisposedException(nameof(Transaction)); } if (resourceManagerIdentifier == Guid.Empty) { throw new ArgumentException(SR.BadResourceManagerId, nameof(resourceManagerIdentifier)); } if (promotableNotification == null) { throw new ArgumentNullException(nameof(promotableNotification)); } if (enlistmentNotification == null) { throw new ArgumentNullException(nameof(enlistmentNotification)); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException(nameof(enlistmentOptions)); } if (_complete) { throw TransactionException.CreateTransactionCompletedException(DistributedTxId); } lock (_internalTransaction) { Debug.Assert(_internalTransaction.State != null); Enlistment enlistment = _internalTransaction.State.PromoteAndEnlistDurable(_internalTransaction, resourceManagerIdentifier, promotableNotification, enlistmentNotification, enlistmentOptions, this); if (etwLog.IsEnabled()) { etwLog.MethodExit(TraceSourceType.TraceSourceDistributed, this); } return(enlistment); } }
void DoSingleCommit(ISinglePhaseNotification single) { if (single == null) { return; } single.SinglePhaseCommit(new SinglePhaseEnlistment(this, single)); CheckAborted(); }
internal InternalEnlistment(System.Transactions.Enlistment enlistment, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, System.Transactions.Transaction atomicTransaction) { this.enlistment = enlistment; this.transaction = transaction; this.twoPhaseNotifications = twoPhaseNotifications; this.singlePhaseNotifications = singlePhaseNotifications; this.atomicTransaction = atomicTransaction; this.enlistmentId = transaction.enlistmentCount++; this.traceIdentifier = EnlistmentTraceIdentifier.Empty; }
internal Enlistment(InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction, EnlistmentOptions enlistmentOptions) { if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None) { this.internalEnlistment = new System.Transactions.InternalEnlistment(this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction); } else { this.internalEnlistment = new Phase1VolatileEnlistment(this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction); } }
internal DurableInternalEnlistment( Enlistment enlistment, Guid resourceManagerIdentifier, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction) : base(enlistment, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction) { _resourceManagerIdentifier = resourceManagerIdentifier; }
public Enlistment PromoteAndEnlistDurable(Guid resourceManagerIdentifier, IPromotableSinglePhaseNotification promotableNotification, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(SR.TraceSourceDistributed, "Transaction.PromoteAndEnlistDurable"); } if (Disposed) { throw new ObjectDisposedException(nameof(Transaction)); } if (resourceManagerIdentifier == Guid.Empty) { throw new ArgumentException(SR.BadResourceManagerId, nameof(resourceManagerIdentifier)); } if (promotableNotification == null) { throw new ArgumentNullException(nameof(promotableNotification)); } if (enlistmentNotification == null) { throw new ArgumentNullException(nameof(enlistmentNotification)); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException(nameof(enlistmentOptions)); } if (_complete) { throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId); } lock (_internalTransaction) { Enlistment enlistment = _internalTransaction.State.PromoteAndEnlistDurable(_internalTransaction, resourceManagerIdentifier, promotableNotification, enlistmentNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(SR.TraceSourceDistributed, "Transaction.PromoteAndEnlistDurable"); } return(enlistment); } }
internal InternalEnlistment( Enlistment enlistment, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction) { _enlistment = enlistment; _transaction = transaction; _twoPhaseNotifications = twoPhaseNotifications; _singlePhaseNotifications = singlePhaseNotifications; _atomicTransaction = atomicTransaction; _enlistmentId = transaction._enlistmentCount++; _traceIdentifier = EnlistmentTraceIdentifier.Empty; }
internal Enlistment( Guid resourceManagerIdentifier, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction) { _internalEnlistment = new DurableInternalEnlistment( this, resourceManagerIdentifier, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction ); }
internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { if ((tx.durableEnlistment != null) || ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None)) { tx.promoteState.EnterState(tx); return tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction); } Enlistment enlistment = new Enlistment(resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction); tx.durableEnlistment = enlistment.InternalEnlistment; DurableEnlistmentState._DurableEnlistmentActive.EnterState(tx.durableEnlistment); if (DiagnosticTrace.Information) { EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, EnlistmentType.Durable, EnlistmentOptions.None); } return enlistment; }
private void DoCommit() { /* Scope becomes null in TransactionScope.Dispose */ if (Scope != null) { /* See test ExplicitTransaction8 */ Rollback(null, null); CheckAborted(); } var volatiles = Volatiles; var durables = Durables; if (volatiles.Count == 1 && durables.Count == 0) { /* Special case */ ISinglePhaseNotification single = volatiles[0] as ISinglePhaseNotification; if (single != null) { DoSingleCommit(single); Complete(); return; } } if (volatiles.Count > 0) { DoPreparePhase(); } if (durables.Count > 0) { DoSingleCommit(durables[0]); } if (pspe != null) { DoSingleCommit(pspe); } if (volatiles.Count > 0) { DoCommitPhase(); } Complete(); }
internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { Enlistment enlistment = new Enlistment(tx, enlistmentNotification, enlistmentNotification, atomicTransaction, enlistmentOptions); if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None) { base.AddVolatileEnlistment(ref tx.phase0Volatiles, enlistment); } else { base.AddVolatileEnlistment(ref tx.phase1Volatiles, enlistment); } if (DiagnosticTrace.Information) { EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions); } return enlistment; }
internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { Enlistment enlistment2; Monitor.Exit(tx); try { Enlistment enlistment = new Enlistment(enlistmentNotification, tx, atomicTransaction); EnlistmentState._EnlistmentStatePromoted.EnterState(enlistment.InternalEnlistment); enlistment.InternalEnlistment.PromotedEnlistment = tx.PromotedTransaction.EnlistVolatile((ISinglePhaseNotificationInternal)enlistment.InternalEnlistment, enlistmentOptions); enlistment2 = enlistment; } finally { Monitor.Enter(tx); } return(enlistment2); }
internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { Enlistment enlistment = new Enlistment(tx, enlistmentNotification, enlistmentNotification, atomicTransaction, enlistmentOptions); if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None) { base.AddVolatileEnlistment(ref tx.phase0Volatiles, enlistment); } else { base.AddVolatileEnlistment(ref tx.phase1Volatiles, enlistment); } if (DiagnosticTrace.Information) { EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions); } return(enlistment); }
// Forward request to the state machine to take the appropriate action. // public Enlistment EnlistVolatile(ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this); } if (Disposed) { throw new ObjectDisposedException(nameof(Transaction)); } if (singlePhaseNotification == null) { throw new ArgumentNullException(nameof(singlePhaseNotification)); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException(nameof(enlistmentOptions)); } if (_complete) { throw TransactionException.CreateTransactionCompletedException(DistributedTxId); } lock (_internalTransaction) { Debug.Assert(_internalTransaction.State != null); Enlistment enlistment = _internalTransaction.State.EnlistVolatile(_internalTransaction, singlePhaseNotification, enlistmentOptions, this); if (etwLog.IsEnabled()) { etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this); } return(enlistment); } }
public Enlistment EnlistDurable(Guid manager, ISinglePhaseNotification notification, EnlistmentOptions options) { EnsureIncompleteCurrentScope(); if (pspe != null || Durables.Count > 0) { throw new NotImplementedException("DTC unsupported, multiple durable resource managers aren't supported."); } if (options != EnlistmentOptions.None) { throw new NotImplementedException("EnlistmentOptions other than None aren't supported"); } Durables.Add(notification); /* FIXME: Enlistment ?? */ return(new Enlistment()); }
// Forward request to the state machine to take the appropriate action. // public Enlistment EnlistVolatile(ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistVolatile( ISinglePhaseNotification )"); } if (Disposed) { throw new ObjectDisposedException(nameof(Transaction)); } if (singlePhaseNotification == null) { throw new ArgumentNullException(nameof(singlePhaseNotification)); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException(nameof(enlistmentOptions)); } if (_complete) { throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId); } lock (_internalTransaction) { Enlistment enlistment = _internalTransaction.State.EnlistVolatile(_internalTransaction, singlePhaseNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistVolatile( ISinglePhaseNotification )" ); } return(enlistment); } }
public Enlistment EnlistDurable(Guid manager, ISinglePhaseNotification notification, EnlistmentOptions options) { if (durables.Count == 1) { throw new NotImplementedException("Only LTM supported. Cannot have more than 1 durable resource per transaction."); } EnsureIncompleteCurrentScope(); if (options != EnlistmentOptions.None) { throw new NotImplementedException("Implement me"); } durables.Add(notification); /* FIXME: Enlistment ?? */ return(new Enlistment()); }
public void InDoubt() { var tso = new Transactional <SimpleObject>(); SimpleObject obj = new SimpleObject { TestInt = 7, TestGuid = Guid.NewGuid(), TestString = "Testing" }; MockRepository mocks = new MockRepository(); ISinglePhaseNotification badResource = mocks.StrictMock <ISinglePhaseNotification>(); badResource.SinglePhaseCommit(null); Action <SinglePhaseEnlistment> onCommit = (SinglePhaseEnlistment spe) => spe.InDoubt(); LastCall.IgnoreArguments().Do(onCommit); mocks.ReplayAll(); Assert.Throws <TransactionInDoubtException>(() => { using (TransactionScope scope = new TransactionScope()) { tso.Value = obj; Transaction.Current.EnlistDurable(Guid.NewGuid(), badResource, EnlistmentOptions.None); scope.Complete(); } }); Assert.IsNull(tso.Value); }
internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { throw new TransactionException(System.Transactions.SR.GetString("TooLate")); }
internal virtual Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { throw TransactionException.CreateTransactionStateException(System.Transactions.SR.GetString("TraceSourceLtm"), tx.innerException); }
internal override Enlistment EnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { tx.ThrowIfPromoterTypeIsNotMSDTC(); if (tx._durableEnlistment != null || (enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0) { // These circumstances cause promotion tx._promoteState.EnterState(tx); return tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction); } // Create a durable enlistment Enlistment en = new Enlistment(resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction); tx._durableEnlistment = en.InternalEnlistment; DurableEnlistmentState.DurableEnlistmentActive.EnterState(tx._durableEnlistment); TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.TransactionstateEnlist(tx._durableEnlistment.EnlistmentTraceId, EnlistmentType.Durable, EnlistmentOptions.None); } return en; }
internal override Enlistment EnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { tx.ThrowIfPromoterTypeIsNotMSDTC(); Enlistment en = base.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction); // Calling durable enlist in Phase0 may cause the transaction to promote. Leverage the promoted tx.State.RestartCommitIfNeeded(tx); return en; }
public Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { }
internal override Enlistment PromoteAndEnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, IPromotableSinglePhaseNotification promotableNotification, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { // This call is only allowed if we have an outstanding call to ITransactionPromoter.Promote. if (!tx._attemptingPSPEPromote) { throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId); } if (promotableNotification != tx._promoter) { throw TransactionException.CreateInvalidOperationException( TraceSourceType.TraceSourceLtm, SR.InvalidIPromotableSinglePhaseNotificationSpecified, null, tx.DistributedTxId ); } Enlistment enlistment; // First promote the transaction. We do this by simply changing the state of the transaction to Promoted. // In TransactionStateActive.EnlistPromotableSinglePhase, tx.durableEnlistment was set to point at the InternalEnlistment // for that PSPE enlistment. We are going to replace that with a "true" durable enlistment here. But we need to // set tx.durableEnlistment to null BEFORE we promote because if we don't the promotion will attempt to promote // the tx.durableEnlistment. Because we are doing the EnlistDurable AFTER promotion, it will be a "promoted" // durable enlistment and we can safely set tx.durableEnlistment to the InternalEnlistment of that Enlistment. tx._durableEnlistment = null; tx._promoteState = TransactionState.TransactionStatePromoted; tx._promoteState.EnterState(tx); // Now we need to create the durable enlistment that will replace the PSPE enlistment. Use the internalEnlistment of // this newly created durable enlistment as the tx.durableEnlistment. enlistment = tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction); tx._durableEnlistment = enlistment.InternalEnlistment; return enlistment; }
internal virtual Enlistment EnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId); }
// Forward request to the state machine to take the appropriate action. // public Enlistment EnlistDurable( Guid resourceManagerIdentifier, ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistDurable( ISinglePhaseNotification )"); } if (Disposed) { throw new ObjectDisposedException(nameof(Transaction)); } if (resourceManagerIdentifier == Guid.Empty) { throw new ArgumentException(SR.BadResourceManagerId, nameof(resourceManagerIdentifier)); } if (singlePhaseNotification == null) { throw new ArgumentNullException(nameof(singlePhaseNotification)); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException(nameof(enlistmentOptions)); } if (_complete) { throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId); } lock (_internalTransaction) { Enlistment enlistment = _internalTransaction.State.EnlistDurable(_internalTransaction, resourceManagerIdentifier, singlePhaseNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistDurable( ISinglePhaseNotification )"); } return enlistment; } }
public Enlistment EnlistVolatile(ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions) { }
internal override Enlistment EnlistVolatile( InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { Enlistment enlistment = new Enlistment(tx, enlistmentNotification, enlistmentNotification, atomicTransaction, enlistmentOptions); if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != 0) { AddVolatileEnlistment(ref tx._phase0Volatiles, enlistment); } else { AddVolatileEnlistment(ref tx._phase1Volatiles, enlistment); } TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log; if (etwLog.IsEnabled()) { etwLog.TransactionstateEnlist(enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions); } return enlistment; }
internal override Enlistment EnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { Debug.Assert(tx.PromotedTransaction != null, "Promoted state not valid for transaction."); tx.ThrowIfPromoterTypeIsNotMSDTC(); // Don't hold locks while calling into the promoted tx Monitor.Exit(tx); try { Enlistment en = new Enlistment( resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction ); EnlistmentState.EnlistmentStatePromoted.EnterState(en.InternalEnlistment); en.InternalEnlistment.PromotedEnlistment = tx.PromotedTransaction.EnlistDurable( resourceManagerIdentifier, (DurableInternalEnlistment)en.InternalEnlistment, true, enlistmentOptions ); return en; } finally { Monitor.Enter(tx); } }
internal override Enlistment EnlistVolatile( InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { Debug.Assert(tx.PromotedTransaction != null, "Promoted state not valid for transaction."); // Don't get in the way for new volatile enlistments // Don't hold locks while calling into the promoted tx Monitor.Exit(tx); try { Enlistment en = new Enlistment(enlistmentNotification, tx, atomicTransaction); EnlistmentState.EnlistmentStatePromoted.EnterState(en.InternalEnlistment); en.InternalEnlistment.PromotedEnlistment = tx.PromotedTransaction.EnlistVolatile( en.InternalEnlistment, enlistmentOptions); return en; } finally { Monitor.Enter(tx); } }
internal DurableInternalEnlistment( Enlistment enlistment, Guid resourceManagerIdentifier, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction ) : base(enlistment, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction) { this.resourceManagerIdentifier = resourceManagerIdentifier; }
internal virtual Enlistment EnlistVolatile( InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId); }
public Phase1VolatileEnlistment( Enlistment enlistment, InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction ) : base(enlistment, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction) { }
internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { Enlistment enlistment = base.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction); tx.State.RestartCommitIfNeeded(tx); return(enlistment); }
internal SinglePhaseEnlistment(Transaction tx, ISinglePhaseNotification enlisted) { this.tx = tx; this.enlisted = enlisted; }
public Enlistment EnlistDurable (Guid manager, ISinglePhaseNotification notification, EnlistmentOptions options) { EnsureIncompleteCurrentScope (); if (pspe != null || Durables.Count > 0) throw new NotImplementedException ("DTC unsupported, multiple durable resource managers aren't supported."); if (options != EnlistmentOptions.None) throw new NotImplementedException ("EnlistmentOptions other than None aren't supported"); Durables.Add (notification); /* FIXME: Enlistment ?? */ return new Enlistment (); }
void DoSingleCommit (ISinglePhaseNotification single) { if (single == null) return; single.SinglePhaseCommit (new SinglePhaseEnlistment (this, single)); CheckAborted (); }
public Enlistment EnlistDurable (Guid manager, ISinglePhaseNotification notification, EnlistmentOptions options) { if (durables.Count == 1) throw new NotImplementedException ("Only LTM supported. Cannot have more than 1 durable resource per transaction."); EnsureIncompleteCurrentScope (); if (options != EnlistmentOptions.None) throw new NotImplementedException ("Implement me"); durables.Add (notification); /* FIXME: Enlistment ?? */ return new Enlistment (); }
internal override Enlistment EnlistVolatile( InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { tx._promoteState.EnterState(tx); return tx.State.EnlistVolatile(tx, enlistmentNotification, enlistmentOptions, atomicTransaction); }
public Enlistment EnlistVolatile ( ISinglePhaseNotification notification, EnlistmentOptions options) { /* FIXME: Anything extra reqd for this? */ return EnlistVolatileInternal (notification, options); }
internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { tx.promoteState.EnterState(tx); return(tx.State.EnlistVolatile(tx, enlistmentNotification, enlistmentOptions, atomicTransaction)); }
internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { throw new TransactionException(System.Transactions.SR.GetString("TooLate")); }
public Enlistment PromoteAndEnlistDurable(Guid resourceManagerIdentifier, IPromotableSinglePhaseNotification promotableNotification, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceOletx), "Transaction.PromoteAndEnlistDurable" ); } if (Disposed) { throw new ObjectDisposedException("Transaction"); } if (resourceManagerIdentifier == Guid.Empty) { throw new ArgumentException(SR.GetString(SR.BadResourceManagerId), "resourceManagerIdentifier"); } if (promotableNotification == null) { throw new ArgumentNullException("promotableNotification"); } if (enlistmentNotification == null) { throw new ArgumentNullException("enlistmentNotification"); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException("enlistmentOptions"); } if (this.complete) { throw TransactionException.CreateTransactionCompletedException(SR.GetString(SR.TraceSourceLtm)); } lock (this.internalTransaction) { Enlistment enlistment = this.internalTransaction.State.PromoteAndEnlistDurable(this.internalTransaction, resourceManagerIdentifier, promotableNotification, enlistmentNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceOletx), "Transaction.PromoteAndEnlistDurable" ); } return enlistment; } }
// Forward request to the state machine to take the appropriate action. // /// <include file='doc\Transaction' path='docs/doc[@for="Transaction.EnlistVolatile"]/*' /> public Enlistment EnlistVolatile( ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions ) { if (DiagnosticTrace.Verbose) { MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm), "Transaction.EnlistVolatile( ISinglePhaseNotification )" ); } if (Disposed) { throw new ObjectDisposedException("Transaction"); } if (singlePhaseNotification == null) { throw new ArgumentNullException("singlePhaseNotification"); } if (enlistmentOptions != EnlistmentOptions.None && enlistmentOptions != EnlistmentOptions.EnlistDuringPrepareRequired) { throw new ArgumentOutOfRangeException("enlistmentOptions"); } if (this.complete) { throw TransactionException.CreateTransactionCompletedException(SR.GetString(SR.TraceSourceLtm)); } lock (this.internalTransaction) { Enlistment enlistment = this.internalTransaction.State.EnlistVolatile(this.internalTransaction, singlePhaseNotification, enlistmentOptions, this); if (DiagnosticTrace.Verbose) { MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm), "Transaction.EnlistVolatile( ISinglePhaseNotification )" ); } return enlistment; } }
internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { if ((tx.durableEnlistment != null) || ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None)) { tx.promoteState.EnterState(tx); return(tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction)); } Enlistment enlistment = new Enlistment(resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction); tx.durableEnlistment = enlistment.InternalEnlistment; DurableEnlistmentState._DurableEnlistmentActive.EnterState(tx.durableEnlistment); if (DiagnosticTrace.Information) { EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, EnlistmentType.Durable, EnlistmentOptions.None); } return(enlistment); }
internal override Enlistment EnlistDurable( InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { throw new TransactionPromotionException(SR.Format(SR.PromoterTypeUnrecognized, tx._promoterType.ToString()), tx._innerException); }
internal override Enlistment EnlistVolatile( InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction ) { throw TransactionException.Create(SR.TooLate, tx == null ? Guid.Empty : tx.DistributedTxId); }
internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction) { Enlistment enlistment2; Monitor.Exit(tx); try { Enlistment enlistment = new Enlistment(resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction); EnlistmentState._EnlistmentStatePromoted.EnterState(enlistment.InternalEnlistment); enlistment.InternalEnlistment.PromotedEnlistment = tx.PromotedTransaction.EnlistDurable(resourceManagerIdentifier, (DurableInternalEnlistment)enlistment.InternalEnlistment, true, enlistmentOptions); enlistment2 = enlistment; } finally { Monitor.Enter(tx); } return(enlistment2); }