internal IPromotedEnlistment EnlistVolatile(ISinglePhaseNotificationInternal singlePhaseNotification, EnlistmentOptions enlistmentOptions)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.EnlistVolatile( ISinglePhaseNotificationInternal )");
            }
            if ((this.realOletxTransaction == null) || this.realOletxTransaction.TooLateForEnlistments)
            {
                throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceOletx"), System.Transactions.SR.GetString("TooLate"), null);
            }
            IPromotedEnlistment enlistment = this.realOletxTransaction.EnlistVolatile(singlePhaseNotification, enlistmentOptions, this);

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.EnlistVolatile( ISinglePhaseNotificationInternal )");
            }
            return(enlistment);
        }
        internal IPromotedEnlistment EnlistDurable(Guid resourceManagerIdentifier, ISinglePhaseNotificationInternal singlePhaseNotification, bool canDoSinglePhase, EnlistmentOptions enlistmentOptions)
        {
            if (DiagnosticTrace.Verbose)
            {
                MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.EnlistDurable( ISinglePhaseNotificationInternal )");
            }
            if ((this.realOletxTransaction == null) || this.realOletxTransaction.TooLateForEnlistments)
            {
                throw TransactionException.Create(System.Transactions.SR.GetString("TraceSourceOletx"), System.Transactions.SR.GetString("TooLate"), null);
            }
            OletxEnlistment enlistment = this.realOletxTransaction.OletxTransactionManagerInstance.FindOrRegisterResourceManager(resourceManagerIdentifier).EnlistDurable(this, canDoSinglePhase, singlePhaseNotification, enlistmentOptions);

            if (DiagnosticTrace.Verbose)
            {
                MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.EnlistDurable( ISinglePhaseNotificationInternal )");
            }
            return(enlistment);
        }
 internal IPromotedEnlistment EnlistVolatile(ISinglePhaseNotificationInternal enlistmentNotification, EnlistmentOptions enlistmentOptions, OletxTransaction oletxTransaction)
 {
     return this.CommonEnlistVolatile(enlistmentNotification, enlistmentOptions, oletxTransaction);
 }
        public bool PrepareRequest(bool singlePhase, byte[] prepareInfo)
        {
            IEnlistmentShim                 enlistmentShim          = null;
            OletxEnlistmentState            active                  = OletxEnlistmentState.Active;
            IEnlistmentNotificationInternal iEnlistmentNotification = null;
            OletxRecoveryInformation        thingToConvert          = null;

            lock (this)
            {
                if (this.state == OletxEnlistmentState.Active)
                {
                    active = this.state = OletxEnlistmentState.Preparing;
                }
                else
                {
                    active = this.state;
                }
                iEnlistmentNotification = this.iEnlistmentNotification;
                enlistmentShim          = this.EnlistmentShim;
                base.oletxTransaction.realOletxTransaction.TooLateForEnlistments = true;
            }
            if (OletxEnlistmentState.Preparing == active)
            {
                thingToConvert     = new OletxRecoveryInformation(prepareInfo);
                this.isSinglePhase = singlePhase;
                long length = prepareInfo.Length;
                this.proxyPrepareInfoByteArray = new byte[length];
                Array.Copy(prepareInfo, this.proxyPrepareInfoByteArray, length);
                if (this.isSinglePhase && this.canDoSinglePhase)
                {
                    ISinglePhaseNotificationInternal internal3 = (ISinglePhaseNotificationInternal)iEnlistmentNotification;
                    this.state = OletxEnlistmentState.SinglePhaseCommitting;
                    if (DiagnosticTrace.Verbose)
                    {
                        EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, NotificationCall.SinglePhaseCommit);
                    }
                    internal3.SinglePhaseCommit(this);
                    return(true);
                }
                byte[] resourceManagerRecoveryInformation = TransactionManager.ConvertToByteArray(thingToConvert);
                this.state = OletxEnlistmentState.Preparing;
                this.prepareInfoByteArray = TransactionManager.GetRecoveryInformation(base.oletxResourceManager.oletxTransactionManager.CreationNodeName, resourceManagerRecoveryInformation);
                if (DiagnosticTrace.Verbose)
                {
                    EnlistmentNotificationCallTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, NotificationCall.Prepare);
                }
                iEnlistmentNotification.Prepare(this);
                return(false);
            }
            if (OletxEnlistmentState.Prepared == active)
            {
                try
                {
                    enlistmentShim.PrepareRequestDone(OletxPrepareVoteType.Prepared);
                    return(false);
                }
                catch (COMException exception3)
                {
                    OletxTransactionManager.ProxyException(exception3);
                    throw;
                }
            }
            if (OletxEnlistmentState.Done == active)
            {
                try
                {
                    bool flag;
                    try
                    {
                        enlistmentShim.PrepareRequestDone(OletxPrepareVoteType.ReadOnly);
                        flag = true;
                    }
                    finally
                    {
                        this.FinishEnlistment();
                    }
                    return(flag);
                }
                catch (COMException exception2)
                {
                    OletxTransactionManager.ProxyException(exception2);
                    throw;
                }
            }
            try
            {
                enlistmentShim.PrepareRequestDone(OletxPrepareVoteType.Failed);
            }
            catch (COMException exception)
            {
                if (DiagnosticTrace.Verbose)
                {
                    ExceptionConsumedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), exception);
                }
            }
            return(true);
        }
Beispiel #5
0
        internal IPromotedEnlistment EnlistDurable(
            Guid resourceManagerIdentifier,
            ISinglePhaseNotificationInternal singlePhaseNotification,
            bool canDoSinglePhase,
            EnlistmentOptions enlistmentOptions
            )
        {
            if ( DiagnosticTrace.Verbose )
            {
                MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "OletxTransaction.EnlistDurable( ISinglePhaseNotificationInternal )"
                    );
            }

            Debug.Assert( ( 0 == this.disposed ), "OletxTransction object is disposed" );

            if ( this.realOletxTransaction == null || this.realOletxTransaction.TooLateForEnlistments )
            {
                throw TransactionException.Create( SR.GetString( SR.TraceSourceOletx ),
                    SR.GetString( SR.TooLate ), null, this.DistributedTxId);
            }

            // get the Oletx TM from the real class
            OletxTransactionManager oletxTM = realOletxTransaction.OletxTransactionManagerInstance;

            // get the resource manager from the Oletx TM
            OletxResourceManager rm = oletxTM.FindOrRegisterResourceManager(resourceManagerIdentifier);

            // ask the rm to do the durable enlistment
            OletxEnlistment enlistment = rm.EnlistDurable(
                this,
                canDoSinglePhase,
                singlePhaseNotification,
                enlistmentOptions
                );

            if ( DiagnosticTrace.Verbose )
            {
                MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "OletxTransaction.EnlistDurable( ISinglePhaseNotificationInternal )"
                    );
            }
            return enlistment;
        }
Beispiel #6
0
        internal IPromotedEnlistment EnlistVolatile(
            ISinglePhaseNotificationInternal singlePhaseNotification,
            EnlistmentOptions enlistmentOptions
            )
        {
            if ( DiagnosticTrace.Verbose )
            {
                MethodEnteredTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "OletxTransaction.EnlistVolatile( ISinglePhaseNotificationInternal )"
                    );
            }

            Debug.Assert( null != singlePhaseNotification, "Argument is null" );
            Debug.Assert( ( 0 == this.disposed ), "OletxTransction object is disposed" );

            if ( this.realOletxTransaction == null || this.realOletxTransaction.TooLateForEnlistments )
            {
                throw TransactionException.Create(SR.GetString(SR.TraceSourceOletx),
                    SR.GetString(SR.TooLate), null, this.DistributedTxId);
            }

            IPromotedEnlistment enlistment = realOletxTransaction.EnlistVolatile(
                singlePhaseNotification,
                enlistmentOptions,
                this
                );

            if ( DiagnosticTrace.Verbose )
            {
                MethodExitedTraceRecord.Trace( SR.GetString( SR.TraceSourceOletx ),
                    "OletxTransaction.EnlistVolatile( ISinglePhaseNotificationInternal )"
                    );
            }
            return enlistment;
        }
 internal IPromotedEnlistment EnlistVolatile(ISinglePhaseNotificationInternal enlistmentNotification, EnlistmentOptions enlistmentOptions, OletxTransaction oletxTransaction)
 {
     return(this.CommonEnlistVolatile(enlistmentNotification, enlistmentOptions, oletxTransaction));
 }