private void MQRMIXAStart()
        {
            uint method = 0x50f;

            this.TrEntry(method);
            int num2 = 0;

            try
            {
                base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing xa_start");
                this.xid.TraceFields();
                num2 = this.hconn.Session.MQFap.XA_Start(this.hconn, this.xid, this.hconn.Rmid, 0);
                if ((num2 != 0) && (num2 != 3))
                {
                    TransactionException innerException = new TransactionException(NmqiTools.GetTranslatedExceptionMessage(this.ToString(), 0x20008385, (uint)num2));
                    MQException          exception2     = new MQException(2, 0x893, innerException);
                    CommonServices.SetValidInserts();
                    CommonServices.ArithInsert1   = (uint)this.hconn.Rmid;
                    CommonServices.CommentInsert1 = "xa_start call has failed with return code = " + num2;
                    base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009213, 0);
                    throw exception2;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
        public void MQRMIXARollback()
        {
            uint method = 0x514;

            this.TrEntry(method);
            int flags = 0;

            try
            {
                base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing xa_rollback");
                this.xid.TraceFields();
                int num2 = this.hconn.Session.MQFap.XA_Rollback(this.hconn, this.xid, this.hconn.Rmid, flags);
                if (num2 != 0)
                {
                    TransactionException innerException = new TransactionException(NmqiTools.GetTranslatedExceptionMessage(this.ToString(), 0x20008385, (uint)num2));
                    MQException          exception2     = new MQException(2, 0x893, innerException);
                    CommonServices.SetValidInserts();
                    CommonServices.ArithInsert1   = (uint)this.hconn.Rmid;
                    CommonServices.CommentInsert1 = "xa_rollback call has failed with return code = " + num2;
                    base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009213, 0);
                    throw exception2;
                }
                base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing MQGET to remove recovery message.");
                this.hconn.XARecoveryBridge.LogCurrentTransactionEnd(this.xid, this.hconn.Rmid);
            }
            finally
            {
                base.TrExit(method);
            }
        }
        public void MQRMIXACommit(bool onephase)
        {
            uint method = 0x513;

            this.TrEntry(method, new object[] { onephase });
            int flags = onephase ? 0x40000000 : 0;

            try
            {
                base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing xa_commit");
                this.xid.TraceFields();
                int num3 = this.hconn.Session.MQFap.XA_Commit(this.hconn, this.xid, this.hconn.Rmid, flags);
                if ((num3 != 0) && (num3 != 3))
                {
                    TransactionException innerException = new TransactionException(NmqiTools.GetTranslatedExceptionMessage(this.ToString(), 0x20008385, (uint)num3));
                    MQException          exception2     = new MQException(2, 0x893, innerException);
                    CommonServices.SetValidInserts();
                    CommonServices.ArithInsert1   = (uint)this.hconn.Rmid;
                    CommonServices.CommentInsert1 = "xa_commit call has failed with return code = " + num3;
                    base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009213, 0);
                    throw exception2;
                }
                if (!onephase)
                {
                    base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing MQGET to remove recovery message.");
                    this.hconn.XARecoveryBridge.LogCurrentTransactionEnd(this.xid, this.hconn.Rmid);
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
        public int MQRMIXAPrepare(byte[] recoveryInformation)
        {
            uint method = 0x512;

            this.TrEntry(method, new object[] { recoveryInformation });
            int num2 = 0;

            try
            {
                byte[] buffer = null;
                buffer = new byte[this.xid.GetRoundedLength()];
                this.xid.WriteStruct(buffer, 0);
                this.xid.TraceFields();
                base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing xa_prepare");
                num2 = this.hconn.Session.MQFap.XA_Prepare(this.hconn, this.xid, this.hconn.Rmid, this.flags);
                if ((num2 != 0) && (num2 != 3))
                {
                    TransactionException innerException = new TransactionException(NmqiTools.GetTranslatedExceptionMessage(this.ToString(), 0x20008385, (uint)num2));
                    MQException          exception2     = new MQException(2, 0x893, innerException);
                    CommonServices.SetValidInserts();
                    CommonServices.ArithInsert1   = (uint)this.hconn.Rmid;
                    CommonServices.CommentInsert1 = "xa_prepare call has failed with return code = " + num2;
                    base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009213, 0);
                    throw exception2;
                }
                if (num2 == 0)
                {
                    base.TrText(method, "Hconn value = " + this.hconn.Value + " issuing MQPUT for tx recovery.");
                    this.hconn.XARecoveryBridge.LogCurrentTransactionStart(buffer, this.xid, this.myGuid, this.hconn.Rmid, recoveryInformation);
                }
            }
            finally
            {
                base.TrExit(method);
            }
            return(num2);
        }
Ejemplo n.º 5
0
        public void Commit(Enlistment enlistment)
        {
            uint method = 0x524;

            this.TrEntry(method, new object[] { enlistment });
            try
            {
                int num2 = 0;
                MQTransactionRecovery.log.WriteLog("Outcome of the transaction(as per DTC):", "Commit");
                int num3 = 0;
                num2 = 0;
                while (num2 < this.incompleteXids.Count)
                {
                    if (this.recoveryXid.Equals(this.incompleteXids[num2]))
                    {
                        if (MQTransactionRecovery.userMode)
                        {
                            num3 = this.HeuristicTransactionCompletion();
                        }
                        else
                        {
                            num3 = this.recoveryHconn.GetMQFAP.XA_Commit(this.recoveryHconn, this.recoveryXid, this.rmid_, 0);
                            MQTransactionRecovery.log.WriteLog("Transaction Commit was successful with Returncode:  " + num3);
                        }
                        if (num3 < 0)
                        {
                            TransactionException innerException = new TransactionException(NmqiTools.GetTranslatedExceptionMessage(this.ToString(), 0x20008385, (uint)num3));
                            MQException          exception2     = new MQException(2, 0x893, innerException);
                            throw exception2;
                        }
                        enlistment.Done();
                        this.success = true;
                        break;
                    }
                    num2++;
                }
                if (num2 == this.incompleteXids.Count)
                {
                    MQTransactionRecovery.log.WriteLog("This particular Tx is not listed as in-doubt with WMQ. Releasing it now.");
                    enlistment.Done();
                    this.success = true;
                }
            }
            catch (Exception exception3)
            {
                base.TrException(method, exception3);
                MQTransactionRecovery.log.WriteLog("Actual state of the Transaction:", "Unknown/Indoubt");
                throw exception3;
            }
            finally
            {
                base.TrExit(method);
            }
        }