ThrowIfPromoterTypeIsNotMSDTC() private method

private ThrowIfPromoterTypeIsNotMSDTC ( ) : void
return void
Ejemplo n.º 1
0
 internal DistributedTransaction Promote()
 {
     lock (_internalTransaction)
     {
         // This method is only called when we expect to be promoting to MSDTC.
         _internalTransaction.ThrowIfPromoterTypeIsNotMSDTC();
         _internalTransaction.State.Promote(_internalTransaction);
         return(_internalTransaction.PromotedTransaction);
     }
 }
Ejemplo n.º 2
0
 internal OletxTransaction?Promote()
 {
     lock (_internalTransaction)
     {
         Debug.Assert(_internalTransaction.State != null);
         // This method is only called when we expect to be promoting to MSDTC.
         _internalTransaction.ThrowIfPromoterTypeIsNotMSDTC();
         _internalTransaction.State.Promote(_internalTransaction);
         return(_internalTransaction.PromotedTransaction);
     }
 }
Ejemplo n.º 3
0
        internal override void GetObjectData(InternalTransaction tx, SerializationInfo serializationInfo, StreamingContext context)
        {
            Debug.Assert(tx.PromotedTransaction != null, "Promoted state not valid for transaction.");

            // This is not allowed if the transaction's PromoterType is not MSDTC.
            tx.ThrowIfPromoterTypeIsNotMSDTC();

            // Simply get call get object data for the promoted transaction.
            ISerializable serializableTx = tx.PromotedTransaction as ISerializable;
            if (serializableTx == null)
            {
                // The LTM can only support this if the Distributed TM Supports it.
                throw new NotSupportedException();
            }

            // Before forwarding this call to the promoted tx make sure to change
            // the full type info so that only if the promoted tx does not set this
            // then it should be set correctly.
            serializationInfo.FullTypeName = tx.PromotedTransaction.GetType().FullName;

            // Now forward the call.
            serializableTx.GetObjectData(serializationInfo, context);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        internal override void GetObjectData(InternalTransaction tx, SerializationInfo serializationInfo, StreamingContext context)
        {
            // This is not allowed if the transaction's PromoterType is not MSDTC.
            tx.ThrowIfPromoterTypeIsNotMSDTC();

            // Promote the transaction.
            tx._promoteState.EnterState(tx);

            // Forward this call
            tx.State.GetObjectData(tx, serializationInfo, context);

            // Restart the commit process.
            tx.State.RestartCommitIfNeeded(tx);
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        internal override Enlistment EnlistDurable(
            InternalTransaction tx,
            Guid resourceManagerIdentifier,
            IEnlistmentNotification enlistmentNotification,
            EnlistmentOptions enlistmentOptions,
            Transaction atomicTransaction)
        {
            tx.ThrowIfPromoterTypeIsNotMSDTC();

            // Can't support an enlistment that dosn't support SPC
            tx._promoteState.EnterState(tx);
            // Note that just because we did an EnterState above does not mean that the state will be
            // the same when the next method is called.
            return tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction);
        }