public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "Transaction.EnlistPromotableSinglePhase");
            }
            if (this.Disposed)
            {
                throw new ObjectDisposedException("Transaction");
            }
            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException("promotableSinglePhaseNotification");
            }
            if (this.complete)
            {
                throw TransactionException.CreateTransactionCompletedException(System.Transactions.SR.GetString("TraceSourceLtm"));
            }
            bool flag = false;

            lock (this.internalTransaction)
            {
                flag = this.internalTransaction.State.EnlistPromotableSinglePhase(this.internalTransaction, promotableSinglePhaseNotification, this);
            }
            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), "Transaction.EnlistPromotableSinglePhase");
            }
            return(flag);
        }
Exemplo n.º 2
0
 public Enlistment PromoteAndEnlistDurable(
     Guid manager,
     IPromotableSinglePhaseNotification promotableNotification,
     ISinglePhaseNotification notification,
     EnlistmentOptions options)
 {
     throw new NotImplementedException("DTC unsupported, multiple durable resource managers aren't supported.");
 }
Exemplo n.º 3
0
 internal Transaction(Transaction other)
 {
     this.level = other.level;
     this.info = other.info;
     this.dependents = other.dependents;
     this.volatiles = other.Volatiles;
     this.durables = other.Durables;
     this.pspe = other.Pspe;
 }
Exemplo n.º 4
0
 internal Transaction(Transaction other)
 {
     this.level      = other.level;
     this.info       = other.info;
     this.dependents = other.dependents;
     this.volatiles  = other.Volatiles;
     this.durables   = other.Durables;
     this.pspe       = other.Pspe;
 }
Exemplo n.º 5
0
 internal Transaction(Transaction other)
 {
     level      = other.level;
     info       = other.info;
     dependents = other.dependents;
     volatiles  = other.Volatiles;
     durables   = other.Durables;
     pspe       = other.Pspe;
 }
Exemplo n.º 6
0
		internal Transaction (Transaction other)
		{
			level = other.level;
			info = other.info;
			dependents = other.dependents;
			volatiles = other.Volatiles;
			durables = other.Durables;
			pspe = other.Pspe;
		}
Exemplo n.º 7
0
 internal PromotableInternalEnlistment(
     Enlistment enlistment,
     InternalTransaction transaction,
     IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction) :
     base(enlistment, transaction, atomicTransaction)
 {
     _promotableNotificationInterface = promotableSinglePhaseNotification;
 }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        void DoSingleCommit(IPromotableSinglePhaseNotification single)
        {
            if (single == null)
            {
                return;
            }

            single.SinglePhaseCommit(new SinglePhaseEnlistment(this, single));
            CheckAborted();
        }
Exemplo n.º 10
0
 internal void PSPEInitialize(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
     base.CommonEnterState(tx);
     try
     {
         promotableSinglePhaseNotification.Initialize();
     }
     finally
     {
         TransactionState._TransactionStateActive.CommonEnterState(tx);
     }
 }
 internal void PSPEInitialize(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
     base.CommonEnterState(tx);
     try
     {
         promotableSinglePhaseNotification.Initialize();
     }
     finally
     {
         TransactionState._TransactionStateActive.CommonEnterState(tx);
     }
 }
Exemplo n.º 12
0
 // This constructor is for a promotable single phase enlistment.
 internal Enlistment(
     InternalTransaction transaction,
     IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction)
 {
     _internalEnlistment = new PromotableInternalEnlistment(
         this,
         transaction,
         promotableSinglePhaseNotification,
         atomicTransaction
         );
 }
Exemplo n.º 13
0
        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);
            }
        }
Exemplo n.º 14
0
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification notification)
        {
            EnsureIncompleteCurrentScope();

            // The specs aren't entirely clear on whether we can have volatile RMs along with a PSPE, but
            // I'm assuming that yes based on: http://social.msdn.microsoft.com/Forums/br/windowstransactionsprogramming/thread/3df6d4d3-0d82-47c4-951a-cd31140950b3
            if (this.pspe != null || this.Durables.Count > 0)
            {
                return(false);
            }

            this.pspe = notification;
            this.pspe.Initialize();

            return(true);
        }
 internal override bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)
 {
     if (tx.durableEnlistment != null)
     {
         return false;
     }
     TransactionState._TransactionStatePSPEOperation.Phase0PSPEInitialize(tx, promotableSinglePhaseNotification);
     Enlistment enlistment = new Enlistment(tx, promotableSinglePhaseNotification, atomicTransaction);
     tx.durableEnlistment = enlistment.InternalEnlistment;
     if (DiagnosticTrace.Information)
     {
         EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, EnlistmentType.PromotableSinglePhase, EnlistmentOptions.None);
     }
     tx.promoter = promotableSinglePhaseNotification;
     tx.promoteState = TransactionState._TransactionStateDelegated;
     DurableEnlistmentState._DurableEnlistmentActive.EnterState(tx.durableEnlistment);
     return true;
 }
Exemplo n.º 16
0
        public void SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification promotableNotification,
                                                        Guid distributedTransactionIdentifier)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;

            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableNotification));
            }

            if (distributedTransactionIdentifier == Guid.Empty)
            {
                throw new ArgumentException(null, nameof(distributedTransactionIdentifier));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
            }

            lock (_internalTransaction)
            {
                Debug.Assert(_internalTransaction.State != null);
                _internalTransaction.State.SetDistributedTransactionId(_internalTransaction,
                                                                       promotableNotification,
                                                                       distributedTransactionIdentifier);

                if (etwLog.IsEnabled())
                {
                    etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
                }
                return;
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Create a promotable single phase enlistment that promotes to a distributed transaction manager other than MSDTC.
        /// </summary>
        /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
        /// <param name="promoterType">
        /// The promoter type Guid that identifies the format of the byte[] that is returned by the ITransactionPromoter.Promote
        /// call that is implemented by the IPromotableSinglePhaseNotificationObject, and thus the promoter of the transaction.
        /// </param>
        /// <returns>
        /// True if the enlistment is successful.
        ///
        /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
        /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
        /// means.
        ///
        /// If the Transaction.PromoterType matches the promoter type supported by the caller, then the
        /// Transaction.PromotedToken can be retrieved and used to enlist directly with the identified distributed transaction manager.
        ///
        /// How the enlistment is created with the distributed transaction manager identified by the Transaction.PromoterType
        /// is defined by that distributed transaction manager.
        /// </returns>
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Guid promoterType)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;

            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableSinglePhaseNotification));
            }

            if (promoterType == Guid.Empty)
            {
                throw new ArgumentException(SR.PromoterTypeInvalid, nameof(promoterType));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
            }

            bool succeeded = false;

            lock (_internalTransaction)
            {
                Debug.Assert(_internalTransaction.State != null);
                succeeded = _internalTransaction.State.EnlistPromotableSinglePhase(_internalTransaction, promotableSinglePhaseNotification, this, promoterType);
            }

            if (etwLog.IsEnabled())
            {
                etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
            }

            return(succeeded);
        }
Exemplo n.º 18
0
        public void SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification promotableNotification,
                                                        Guid distributedTransactionIdentifier)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.SetDistributedTransactionIdentifier");
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableNotification));
            }

            if (distributedTransactionIdentifier == Guid.Empty)
            {
                throw new ArgumentException(null, nameof(distributedTransactionIdentifier));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId);
            }

            lock (_internalTransaction)
            {
                _internalTransaction.State.SetDistributedTransactionId(_internalTransaction,
                                                                       promotableNotification,
                                                                       distributedTransactionIdentifier);

                if (DiagnosticTrace.Verbose)
                {
                    MethodExitedTraceRecord.Trace(SR.TraceSourceLtm,
                                                  "Transaction.SetDistributedTransactionIdentifier"
                                                  );
                }
                return;
            }
        }
        internal override bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)
        {
            if (tx.durableEnlistment != null)
            {
                return(false);
            }
            TransactionState._TransactionStatePSPEOperation.PSPEInitialize(tx, promotableSinglePhaseNotification);
            Enlistment enlistment = new Enlistment(tx, promotableSinglePhaseNotification, atomicTransaction);

            tx.durableEnlistment = enlistment.InternalEnlistment;
            if (DiagnosticTrace.Information)
            {
                EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, EnlistmentType.PromotableSinglePhase, EnlistmentOptions.None);
            }
            tx.promoter     = promotableSinglePhaseNotification;
            tx.promoteState = TransactionState._TransactionStateDelegated;
            DurableEnlistmentState._DurableEnlistmentActive.EnterState(tx.durableEnlistment);
            return(true);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Create a promotable single phase enlistment that promotes to a distributed transaction manager other than MSDTC.
        /// </summary>
        /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
        /// <param name="promoterType">
        /// The promoter type Guid that identifies the format of the byte[] that is returned by the ITransactionPromoter.Promote
        /// call that is implemented by the IPromotableSinglePhaseNotificationObject, and thus the promoter of the transaction.
        /// </param>
        /// <returns>
        /// True if the enlistment is successful.
        ///
        /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
        /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
        /// means.
        ///
        /// If the Transaction.PromoterType matches the promoter type supported by the caller, then the
        /// Transaction.PromotedToken can be retrieved and used to enlist directly with the identified distributed transaction manager.
        ///
        /// How the enlistment is created with the distributed transaction manager identified by the Transaction.PromoterType
        /// is defined by that distributed transaction manager.
        /// </returns>
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Guid promoterType)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistPromotableSinglePhase");
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableSinglePhaseNotification));
            }

            if (promoterType == Guid.Empty)
            {
                throw new ArgumentException(SR.PromoterTypeInvalid, nameof(promoterType));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId);
            }

            bool succeeded = false;

            lock (_internalTransaction)
            {
                succeeded = _internalTransaction.State.EnlistPromotableSinglePhase(_internalTransaction, promotableSinglePhaseNotification, this, promoterType);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistPromotableSinglePhase");
            }

            return(succeeded);
        }
Exemplo n.º 21
0
 internal virtual bool EnlistPromotableSinglePhase(
     InternalTransaction tx,
     IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction,
     Guid promoterType
     )
 {
     throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId);
 }
Exemplo n.º 22
0
 internal virtual bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)
 {
     throw TransactionException.CreateTransactionStateException(System.Transactions.SR.GetString("TraceSourceLtm"), tx.innerException);
 }
 public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
 }
Exemplo n.º 24
0
		void DoSingleCommit (IPromotableSinglePhaseNotification single)
		{
			if (single == null)
				return;

			single.SinglePhaseCommit (new SinglePhaseEnlistment (this, single));
			CheckAborted ();
		}
Exemplo n.º 25
0
 public void SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification promotableNotification, Guid distributedTransactionIdentifier)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 26
0
        /// <summary>
        /// Create a promotable single phase enlistment that promotes to a distributed transaction manager other than MSDTC.
        /// </summary>
        /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
        /// <param name="promoterType">
        /// The promoter type Guid that identifies the format of the byte[] that is returned by the ITransactionPromoter.Promote
        /// call that is implemented by the IPromotableSinglePhaseNotificationObject, and thus the promoter of the transaction.
        /// </param>
        /// <returns>
        /// True if the enlistment is successful.
        /// 
        /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
        /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
        /// means.
        /// 
        /// If the Transaction.PromoterType matches the promoter type supported by the caller, then the
        /// Transaction.PromotedToken can be retrieved and used to enlist directly with the identified distributed transaction manager.
        ///
        /// How the enlistment is created with the distributed transaction manager identified by the Transaction.PromoterType
        /// is defined by that distributed transaction manager.
        /// </returns>
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Guid promoterType)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableSinglePhaseNotification));
            }

            if (promoterType == Guid.Empty)
            {
                throw new ArgumentException(SR.PromoterTypeInvalid, nameof(promoterType));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
            }

            bool succeeded = false;

            lock (_internalTransaction)
            {
                succeeded = _internalTransaction.State.EnlistPromotableSinglePhase(_internalTransaction, promotableSinglePhaseNotification, this, promoterType);
            }

            if (etwLog.IsEnabled())
            {
                etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
            }

            return succeeded;
        }
Exemplo n.º 27
0
 private static bool EnlistPromotable(IPromotableSinglePhaseNotification promotableNotification, Transaction txToEnlist, Guid promoterType)
 {
     object[] parameters = new object[] { promotableNotification, promoterType };
     bool returnVal = (bool)s_enlistPromotableSinglePhaseMethodInfo.Invoke(txToEnlist, parameters);
     return returnVal;
 }
Exemplo n.º 28
0
        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;
            }
        }
Exemplo n.º 29
0
 // 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
         );
 }
Exemplo n.º 30
0
        /// <summary>
        /// Create a promotable single phase enlistment that promotes to a distributed transaction manager other than MSDTC.
        /// </summary>
        /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
        /// <param name="promoterType">
        /// The promoter type Guid that identifies the format of the byte[] that is returned by the ITransactionPromoter.Promote
        /// call that is implemented by the IPromotableSinglePhaseNotificationObject, and thus the promoter of the transaction.
        /// </param>
        /// <returns>
        /// True if the enlistment is successful.
        /// 
        /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
        /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
        /// means.
        /// 
        /// If the Transaction.PromoterType matches the promoter type supported by the caller, then the
        /// Transaction.PromotedToken can be retrieved and used to enlist directly with the identified distributed transaction manager.
        ///
        /// How the enlistment is created with the distributed transaction manager identified by the Transaction.PromoterType
        /// is defined by that distributed transaction manager.
        /// </returns>
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Guid promoterType)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistPromotableSinglePhase");
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableSinglePhaseNotification));
            }

            if (promoterType == Guid.Empty)
            {
                throw new ArgumentException(SR.PromoterTypeInvalid, nameof(promoterType));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId);
            }

            bool succeeded = false;

            lock (_internalTransaction)
            {
                succeeded = _internalTransaction.State.EnlistPromotableSinglePhase(_internalTransaction, promotableSinglePhaseNotification, this, promoterType);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.EnlistPromotableSinglePhase");
            }

            return succeeded;
        }
Exemplo n.º 31
0
 /// <summary>
 /// Create a promotable single phase enlistment that promotes to MSDTC.
 /// </summary>
 /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
 /// <returns>
 /// True if the enlistment is successful.
 ///
 /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
 /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
 /// means, such as Transaction.EnlistDurable or retrieve the MSDTC export cookie or propagation token to enlist with MSDTC.
 /// </returns>
 // We apparently didn't spell Promotable like FXCop thinks it should be spelled.
 public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
     return(EnlistPromotableSinglePhase(promotableSinglePhaseNotification, TransactionInterop.PromoterTypeDtc));
 }
Exemplo n.º 32
0
 /// <summary>
 /// Create a promotable single phase enlistment that promotes to MSDTC.
 /// </summary>
 /// <param name="promotableSinglePhaseNotification">The object that implements the IPromotableSinglePhaseNotification interface.</param>
 /// <returns>
 /// True if the enlistment is successful.
 /// 
 /// False if the transaction already has a durable enlistment or promotable single phase enlistment or
 /// if the transaction has already promoted. In this case, the caller will need to enlist in the transaction through other
 /// means, such as Transaction.EnlistDurable or retreive the MSDTC export cookie or propagation token to enlist with MSDTC.
 /// </returns>
 // We apparently didn't spell Promotable like FXCop thinks it should be spelled.
 public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
     return EnlistPromotableSinglePhase(promotableSinglePhaseNotification, TransactionInterop.PromoterTypeDtc);
 }
Exemplo n.º 33
0
        public void SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification promotableNotification,
                                                        Guid distributedTransactionIdentifier)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.TraceSourceLtm, "Transaction.SetDistributedTransactionIdentifier");
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableNotification));
            }

            if (distributedTransactionIdentifier == Guid.Empty)
            {
                throw new ArgumentException(null, nameof(distributedTransactionIdentifier));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.TraceSourceLtm, DistributedTxId);
            }

            lock (_internalTransaction)
            {
                _internalTransaction.State.SetDistributedTransactionId(_internalTransaction,
                    promotableNotification,
                    distributedTransactionIdentifier);

                if (DiagnosticTrace.Verbose)
                {
                    MethodExitedTraceRecord.Trace(SR.TraceSourceLtm,
                        "Transaction.SetDistributedTransactionIdentifier"
                        );
                }
                return;
            }
        }
Exemplo n.º 34
0
        public void SetDistributedTransactionIdentifier(IPromotableSinglePhaseNotification promotableNotification,
                                                        Guid distributedTransactionIdentifier)
        {
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.MethodEnter(TraceSourceType.TraceSourceLtm, this);
            }

            if (Disposed)
            {
                throw new ObjectDisposedException(nameof(Transaction));
            }

            if (promotableNotification == null)
            {
                throw new ArgumentNullException(nameof(promotableNotification));
            }

            if (distributedTransactionIdentifier == Guid.Empty)
            {
                throw new ArgumentException(null, nameof(distributedTransactionIdentifier));
            }

            if (_complete)
            {
                throw TransactionException.CreateTransactionCompletedException(DistributedTxId);
            }

            lock (_internalTransaction)
            {
                _internalTransaction.State.SetDistributedTransactionId(_internalTransaction,
                    promotableNotification,
                    distributedTransactionIdentifier);

                if (etwLog.IsEnabled())
                {
                    etwLog.MethodExit(TraceSourceType.TraceSourceLtm, this);
                }
                return;
            }
        }
Exemplo n.º 35
0
		public bool EnlistPromotableSinglePhase (
			IPromotableSinglePhaseNotification notification)
		{
			throw new NotImplementedException ();
		}
 public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
 {
 }
Exemplo n.º 37
0
        public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                    "Transaction.EnlistPromotableSinglePhase"
                    );
            }

            if (Disposed)
            {
                throw new ObjectDisposedException("Transaction");
            }

            if (promotableSinglePhaseNotification == null)
            {
                throw new ArgumentNullException("promotableSinglePhaseNotification");
            }

            if (this.complete)
            {
                throw TransactionException.CreateTransactionCompletedException(SR.GetString(SR.TraceSourceLtm));
            }

            bool succeeded = false;

            lock (this.internalTransaction)
            {
                succeeded = this.internalTransaction.State.EnlistPromotableSinglePhase(this.internalTransaction, promotableSinglePhaseNotification, this);
            }

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(SR.GetString(SR.TraceSourceLtm),
                    "Transaction.EnlistPromotableSinglePhase"
                    );
            }

            return succeeded;
        }
 internal override bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)
 {
     return(false);
 }
Exemplo n.º 39
0
 internal PromotableInternalEnlistment(
     Enlistment enlistment,
     InternalTransaction transaction, 
     IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction
     ) :
     base(enlistment, transaction, atomicTransaction)
 {
     this.promotableNotificationInterface = promotableSinglePhaseNotification;
 }
Exemplo n.º 40
0
 internal override bool EnlistPromotableSinglePhase(
     InternalTransaction tx,
     IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction,
     Guid promoterType
     )
 {
     return false;
 }
 internal virtual bool EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)
 {
     throw TransactionException.CreateTransactionStateException(System.Transactions.SR.GetString("TraceSourceLtm"), tx.innerException);
 }
Exemplo n.º 42
0
        // Support PSPE enlistment during Phase0 prepare notification.

        internal override bool EnlistPromotableSinglePhase(
            InternalTransaction tx,
            IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
            Transaction atomicTransaction,
            Guid promoterType
            )
        {
            // Delegation will fail if there is a durable enlistment
            if (tx._durableEnlistment != null)
            {
                return false;
            }

            // Initialize PSPE Operation and call initialize on IPromotableSinglePhaseNotification
            TransactionStatePSPEOperation.Phase0PSPEInitialize(tx, promotableSinglePhaseNotification, promoterType);

            // Create a durable enlistment.
            Enlistment en = new Enlistment(tx, promotableSinglePhaseNotification, atomicTransaction);
            tx._durableEnlistment = en.InternalEnlistment;
            TransactionsEtwProvider etwLog = TransactionsEtwProvider.Log;
            if (etwLog.IsEnabled())
            {
                etwLog.TransactionstateEnlist(tx._durableEnlistment.EnlistmentTraceId, EnlistmentType.PromotableSinglePhase, EnlistmentOptions.None);
            }

            // Specify the promoter for the transaction.
            tx._promoter = promotableSinglePhaseNotification;

            // Change the state that the transaction will promote to.  Normally this would be simply
            // be TransactionStatePromoted.  However it now needs to promote to a delegated state.
            // If the PromoterType is NOT TransactionInterop.PromoterTypeDtc, then the promoteState needs
            // to be TransactionStateDelegatedNonMSDTC.
            // tx.PromoterType was set in Phase0PSPEInitialize.
            Debug.Assert(tx._promoterType != Guid.Empty, "InternalTransaction.PromoterType was not set in Phase0PSPEInitialize");
            if (tx._promoterType == TransactionInterop.PromoterTypeDtc)
            {
                tx._promoteState = TransactionStateDelegated;
            }
            else
            {
                tx._promoteState = TransactionStateDelegatedNonMSDTC;
            }

            // Put the enlistment in an active state
            DurableEnlistmentState.DurableEnlistmentActive.EnterState(tx._durableEnlistment);

            // Hand back the enlistment.
            return true;
        }
Exemplo n.º 43
0
 internal override bool EnlistPromotableSinglePhase(
     InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction,
     Guid promoterType
     )
 {
     // The transaction has been promoted and cannot support a promotable singe phase enlistment
     return false;
 }
Exemplo n.º 44
0
 internal override bool EnlistPromotableSinglePhase(
     InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
     Transaction atomicTransaction,
     Guid promoterType
     )
 {
     throw TransactionException.Create(SR.TooLate, tx == null ? Guid.Empty : tx.DistributedTxId);
 }
Exemplo n.º 45
0
		public bool EnlistPromotableSinglePhase (
			IPromotableSinglePhaseNotification notification)
		{
			EnsureIncompleteCurrentScope ();

			// The specs aren't entirely clear on whether we can have volatile RMs along with a PSPE, but
			// I'm assuming that yes based on: http://social.msdn.microsoft.com/Forums/br/windowstransactionsprogramming/thread/3df6d4d3-0d82-47c4-951a-cd31140950b3
			if (pspe != null || Durables.Count > 0)
				return false;

			pspe = notification;
			pspe.Initialize();

			return true;
		}
Exemplo n.º 46
0
        // This method will call the intialize method on IPromotableSinglePhaseNotification.
        // The tx state will be set to TransactionStatePhase0 to receive and process further
        // enlistments during Phase0. 

        internal void Phase0PSPEInitialize(
            InternalTransaction tx,
            IPromotableSinglePhaseNotification promotableSinglePhaseNotification,
            Guid promoterType)
        {
            Debug.Assert(tx.State == TransactionStatePhase0, "Phase0PSPEInitialize called from state other than TransactionStatePhase0");
            CommonEnterState(tx);

            try
            {
                // Try to initialize the PSPE.  If an exception is thrown let it propagate
                // all the way up to the caller.
                promotableSinglePhaseNotification.Initialize();

                // Set the PromoterType for the transaction.
                tx._promoterType = promoterType;
            }
            finally
            {
                TransactionStatePhase0.CommonEnterState(tx);
            }
        }
Exemplo n.º 47
0
 public bool EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Guid promoterType)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 48
0
        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;
        }
Exemplo n.º 49
0
 static bool \u202E‭‌‫‮‫‍‪‎‍‮‬‫‏‫‭‪​​‫‎​‌‪‮([In] Transaction obj0, [In] IPromotableSinglePhaseNotification obj1)
 {
     // ISSUE: unable to decompile the method.
 }
Exemplo n.º 50
0
        // TransactionStatePSPEOperation is the only state where this is allowed and we further check to make sure there is
        // an outstanding call to ITransactionPromoter.Promote and that the specified promotableNotification matches the
        // transaction's promoter object.
        internal override void SetDistributedTransactionId(InternalTransaction tx,
                    IPromotableSinglePhaseNotification promotableNotification,
                    Guid distributedTransactionIdentifier)
        {
            // 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
                        );
            }

            tx._distributedTransactionIdentifierNonMSDTC = distributedTransactionIdentifier;
        }
Exemplo n.º 51
0
 internal virtual Enlistment PromoteAndEnlistDurable(
     InternalTransaction tx,
     Guid resourceManagerIdentifier,
     IPromotableSinglePhaseNotification promotableNotification,
     ISinglePhaseNotification enlistmentNotification,
     EnlistmentOptions enlistmentOptions,
     Transaction atomicTransaction)
 {
     throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId);
 }
Exemplo n.º 52
0
 private static void SetDistributedTransactionId(IPromotableSinglePhaseNotification promotableNotification, Transaction txToSet, Guid distributedId)
 {
     object[] parameters = new object[] { promotableNotification, distributedId };
     s_setDistributedTransactionIdentifierMethodInfo.Invoke(txToSet, parameters);
 }
Exemplo n.º 53
0
 internal virtual void SetDistributedTransactionId(InternalTransaction tx,
             IPromotableSinglePhaseNotification promotableNotification,
             Guid distributedTransactionIdentifier)
 {
     throw TransactionException.CreateTransactionStateException(tx._innerException, tx.DistributedTxId);
 }
Exemplo n.º 54
0
 public bool EnlistPromotableSinglePhase(
     IPromotableSinglePhaseNotification notification)
 {
     throw new NotImplementedException();
 }