internal void EnlistTransactionIntoDtc()
        {
            uint method = 0x4f8;

            this.TrEntry(method);
            try
            {
                base.TrText(method, "ResourceManager Id:- " + NmqiTools.ArrayToHexString(this.myGuid.ToByteArray()));
                base.TrText(method, "Hconn = " + base.hconn.Value);
                base.TrText(method, "Enlisting as Durable Resource manager into Current Transaction");
                base.InitializeMQRMI();
                Transaction.Current.EnlistDurable(base.myGuid, (ISinglePhaseNotification)this, EnlistmentOptions.EnlistDuringPrepareRequired);
                base.TrText(method, "WMQ .NET Enlisted as Resource Manager with Transaction Co-ordinator");
                base.hconn.currentTransaction = Transaction.Current;
                base.TrText(method, "Current Transaction's Information");
                base.TrText(method, "DistributedIdentifier:- " + NmqiTools.ArrayToHexString(Transaction.Current.TransactionInformation.DistributedIdentifier.ToByteArray()));
                base.TrText(method, "LocalIdentifier:- " + Transaction.Current.TransactionInformation.LocalIdentifier);
            }
            catch (MQException exception)
            {
                base.TrException(method, exception, 1);
                throw exception;
            }
            catch (TransactionException exception2)
            {
                base.TrException(method, exception2, 2);
                MQException exception3 = new MQException(2, 0x932, exception2);
                throw exception3;
            }
            finally
            {
                base.TrExit(method);
            }
        }
        internal void WriteTransactionID(Guid GlobalTID, string localTID)
        {
            uint method = 0x51a;

            this.TrEntry(method, new object[] { GlobalTID, localTID });
            string str  = "[" + NmqiTools.ArrayToHexString(GlobalTID.ToByteArray()) + "]";
            string str2 = "[" + localTID + "]";

            lock (this.mutex)
            {
                writer_.WriteLine(this.GetHeader() + "Global Transaction ID: " + str);
                writer_.WriteLine(this.GetHeader() + "Local Transaction ID: " + str2);
            }
            base.TrExit(method);
        }
示例#3
0
        internal void LogCurrentTransactionStart(byte[] xidBytes, MQXid xid, Guid queueManagerUid, int rmid, byte[] recinfo)
        {
            uint method = 0x52b;

            this.TrEntry(method, new object[] { xidBytes, queueManagerUid, rmid, recinfo });
            try
            {
                MQMessage mqMsg = new MQMessage();
                mqMsg.Persistence = 1;
                int     compCode = 0;
                int     reason   = 0;
                sbyte[] dst      = new sbyte[queueManagerUid.ToByteArray().Length];
                Buffer.BlockCopy(queueManagerUid.ToByteArray(), 0, dst, 0, dst.Length);
                base.TrText(method, "Qmid=" + NmqiTools.ArrayToHexString(queueManagerUid.ToByteArray()));
                sbyte[] numArray2 = new sbyte[recinfo.Length];
                Buffer.BlockCopy(recinfo, 0, numArray2, 0, numArray2.Length);
                base.TrText(method, "recordinfo=" + NmqiTools.ArrayToHexString(recinfo));
                sbyte[] numArray3 = new sbyte[xidBytes.Length];
                Buffer.BlockCopy(xidBytes, 0, numArray3, 0, numArray3.Length);
                base.TrText(method, "recordinfo=" + NmqiTools.ArrayToHexString(xidBytes));
                mqMsg.SetBytesProperty("dnet.XARECOVERY_QMID", dst);
                mqMsg.SetBytesProperty("dnet.XARECOVERY_RECINFO", numArray2);
                mqMsg.SetBytesProperty("dnet.XARECOVERY_XID", numArray3);
                mqMsg.SetIntProperty("dnet.XARECOVERY_RMID", rmid);
                mqMsg.SetDoubleProperty("dnet.XARECOVERY_TTIMEOUT", TransactionManager.MaximumTimeout.TotalMilliseconds);
                mqMsg.SetStringProperty("dnet.XARECOVERY_HOSTANDUSER", this.hostAndUser);
                this.marshal = new MQMarshalMessageForPut(mqMsg);
                mqMsg        = this.marshal.ConstructMessageForSend();
                byte[] sBuff           = mqMsg.GetBuffer();
                MQMessageDescriptor md = mqMsg.md;
                this.recoveryHconn.Session.MQFap.MQPUT(this.recoveryHconn, this.recoveryHobj.HOBJ, ref md, ref this.recoveryPutPmo, sBuff.Length, sBuff, null, 1, out compCode, out reason);
                base.TrText(method, "MessageId-" + NmqiTools.ArrayToHexString(md.MsgId));
                if (compCode != 0)
                {
                    base.throwNewMQException(compCode, reason);
                }
                this.TransactionLogList.Add(xid, mqMsg.md);
                this.marshal.Dispose(false);
                this.marshal = null;
                mqMsg        = null;
                sBuff        = null;
            }
            finally
            {
                base.TrExit(method);
            }
        }
示例#4
0
        internal void LogCurrentTransactionEnd(MQXid xid, int rmid)
        {
            uint method = 0x52c;

            this.TrEntry(method, new object[] { xid, rmid });
            MQMessageDescriptor msgDesc = new MQMessageDescriptor();

            msgDesc.Version = 2;
            try
            {
                if (this.TransactionLogList.ContainsKey(xid))
                {
                    MQMessageDescriptor descriptor2 = (MQMessageDescriptor)this.TransactionLogList[xid];
                    msgDesc.MsgId = descriptor2.MsgId;
                    base.TrText(method, "MessageId-" + NmqiTools.ArrayToHexString(msgDesc.MsgId));
                    int          dataLength   = 0;
                    int          bufferLength = 0x1000;
                    byte[]       buffer       = new byte[bufferLength];
                    int          compCode     = 0;
                    int          reason       = 0;
                    MQProxyQueue proxyQueue   = ((ManagedHobj)this.recoveryHobj.HOBJ).ProxyQueue;
                    if (proxyQueue != null)
                    {
                        proxyQueue.ProxyMQGET(msgDesc, this.recoveryGetGmo, bufferLength, buffer, ref dataLength, null, ref compCode, ref reason);
                    }
                    else
                    {
                        this.recoveryHconn.GetMQFAP.MQGET(this.recoveryHconn, this.recoveryHobj.HOBJ, msgDesc, this.recoveryGetGmo, bufferLength, buffer, out dataLength, out compCode, out reason);
                    }
                    if (compCode != 0)
                    {
                        base.throwNewMQException(compCode, reason);
                    }
                    this.TransactionLogList.Remove(xid);
                    buffer = null;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }
示例#5
0
        internal void RunRecovery()
        {
            uint method = 0x521;

            this.TrEntry(method);
            int  num2 = 0;
            bool flag = false;

            while ((num2 = this.Queue.CurrentDepth) > 0)
            {
                flag = true;
                log.WriteLog("SYSTEM.DOTNET.XARECOVERY.QUEUE Current Depth : ", num2.ToString());
                MQMessage message = new MQMessage();
                try
                {
                    this.Queue.Get(message, this.gmoB);
                }
                catch (MQException exception)
                {
                    base.TrException(method, exception, 1);
                    if (exception.Reason == 0x7f1)
                    {
                        break;
                    }
                }
                log.WriteLog("MsgID of current message(recovery message) being processed ", NmqiTools.ArrayToHexString(message.MessageId));
                if (message == null)
                {
                    break;
                }
                sbyte[] xid            = null;
                double  doubleProperty = 0.0;
                string  stringProperty = null;
                try
                {
                    xid            = message.GetBytesProperty("dnet.XARECOVERY_XID");
                    doubleProperty = message.GetDoubleProperty("dnet.XARECOVERY_TTIMEOUT");
                    stringProperty = message.GetStringProperty("dnet.XARECOVERY_HOSTANDUSER");
                }
                catch (MQException exception2)
                {
                    base.TrException(method, exception2, 2);
                    if ((((exception2.Reason != 0x9a7) && (exception2.Reason != 0x98a)) && ((exception2.Reason != 0x9a2) && (exception2.Reason != 0x9a3))) && ((exception2.Reason != 0x9a6) && (exception2.Reason != 0x9a5)))
                    {
                        throw exception2;
                    }
                    continue;
                }
                log.WriteLog("Host,UserId under which the Transaction Recovery message has been put : " + stringProperty);
                log.WriteLog("Current Xid from the indoubt message");
                log.WriteXid(xid);
                DateTime putDateTime = message.PutDateTime;
                DateTime time2       = putDateTime.AddMilliseconds(doubleProperty);
                if (time2 > DateTime.Now)
                {
                    log.WriteLog("TransactionTimeout - " + time2.ToLongTimeString());
                    log.WriteLog("Message arrival time - " + putDateTime.ToLongTimeString());
                    log.WriteLog("Monitor skiping the current messages as transaction did not timeout yet..");
                }
                else
                {
                    try
                    {
                        this.Queue.Get(message, this.gmoG);
                        log.WriteLog("Found one Inomplete Transaction from message,(ID):", NmqiTools.ArrayToHexString(message.MessageId));
                    }
                    catch (MQException exception3)
                    {
                        base.TrException(method, exception3, 2);
                        throw exception3;
                    }
                    try
                    {
                        int     intProperty   = message.GetIntProperty("dnet.XARECOVERY_RMID");
                        sbyte[] bytesProperty = message.GetBytesProperty("dnet.XARECOVERY_QMID");
                        sbyte[] recinfo       = message.GetBytesProperty("dnet.XARECOVERY_RECINFO");
                        sbyte[] numArray4     = message.GetBytesProperty("dnet.XARECOVERY_XID");
                        byte[]  dst           = new byte[bytesProperty.Length];
                        Buffer.BlockCopy(bytesProperty, 0, dst, 0, dst.Length);
                        this.QMId = new Guid(dst);
                        if (this.RecoverTransaction(this.QMId, recinfo, numArray4, intProperty))
                        {
                            this.Qmgr.Commit();
                            if (!CompletedQMId.Contains(this.QMId))
                            {
                                CompletedQMId.Add(this.QMId);
                            }
                        }
                        else
                        {
                            if (CompletedQMId.Contains(this.QMId))
                            {
                                CompletedQMId.Remove(this.QMId);
                            }
                            this.Qmgr.Backout();
                        }
                        continue;
                    }
                    catch (MQException exception4)
                    {
                        base.TrException(method, exception4, 3);
                        throw exception4;
                    }
                }
            }
            foreach (Guid guid in CompletedQMId)
            {
                TransactionManager.RecoveryComplete(guid);
            }
            if (!flag)
            {
                Thread.Sleep(0x1d4c0);
                this.reenter = true;
            }
            base.TrExit(method);
        }
示例#6
0
 public void Add(string name, sbyte[] value)
 {
     this.AddField("", "", name, NmqiTools.ArrayToHexString(value));
 }