Ejemplo n.º 1
0
        public void DeleteProxyQueue(MQProxyQueue proxyQueue)
        {
            uint method = 0x606;

            this.TrEntry(method, new object[] { proxyQueue });
            try
            {
                this.deletePQueue.Acquire();
                ManagedHobj manHobj = proxyQueue.ManHobj;
                if (manHobj != null)
                {
                    int handle = manHobj.Handle;
                    base.TrData(method, 0, "Hobj to be removed", BitConverter.GetBytes(handle));
                    MQProxyQueue queue = this.proxyQueues[handle];
                    if (queue != proxyQueue)
                    {
                        CommonServices.SetValidInserts();
                        CommonServices.ArithInsert1   = 1;
                        CommonServices.CommentInsert1 = "Couldn't find the ProxyQueue..";
                        base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009546, 0);
                        NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x893, null);
                        base.TrException(method, ex);
                        throw ex;
                    }
                    this.proxyQueues.Remove(handle);
                }
            }
            finally
            {
                this.deletePQueue.Release();
                base.TrExit(method);
            }
        }
Ejemplo n.º 2
0
 public ManagedHsub(NmqiEnvironment env, int hsub, ManagedHobj hobj, MQSubscriptionDescriptor subDescriptor, LpiSD spiSD, bool spiCall) : base(env)
 {
     this.initialSubscriptionTime = DateTime.Now.Millisecond;
     this.hsub = -1;
     base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { env, hsub, hobj, subDescriptor });
     this.hsub                  = hsub;
     this.remoteHobj            = hobj;
     this.subDescriptor         = env.NewMQSD();
     this.subDescriptor.Version = subDescriptor.Version;
     if (subDescriptor.AlternateUserId != null)
     {
         this.subDescriptor.AlternateUserId = subDescriptor.AlternateUserId;
     }
     this.subDescriptor.AlternateSecurityId = subDescriptor.AlternateSecurityId;
     if (subDescriptor.ObjectName != null)
     {
         this.subDescriptor.ObjectName = subDescriptor.ObjectName;
     }
     if (subDescriptor.ObjectString.VSString != null)
     {
         this.subDescriptor.ObjectString.VSString  = subDescriptor.ObjectString.VSString;
         this.subDescriptor.ObjectString.VSBufSize = subDescriptor.ObjectString.VSBufSize;
         this.subDescriptor.ObjectString.VSLength  = subDescriptor.ObjectString.VSLength;
     }
     if (subDescriptor.SubName.VSString != null)
     {
         this.subDescriptor.SubName.VSString  = subDescriptor.SubName.VSString;
         this.subDescriptor.SubName.VSBufSize = subDescriptor.SubName.VSBufSize;
     }
     if (subDescriptor.SelectionString.VSString != null)
     {
         this.subDescriptor.SelectionString.VSString  = subDescriptor.SelectionString.VSString;
         this.subDescriptor.SelectionString.VSBufSize = subDescriptor.SelectionString.VSBufSize;
     }
     if (subDescriptor.ResObjectString.VSString != null)
     {
         this.subDescriptor.ResObjectString.VSString  = subDescriptor.ResObjectString.VSString;
         this.subDescriptor.ResObjectString.VSBufSize = subDescriptor.ResObjectString.VSBufSize;
     }
     this.subDescriptor.Options   = subDescriptor.Options;
     this.subDescriptor.SubExpiry = subDescriptor.SubExpiry;
     this.subDescriptor.SubLevel  = subDescriptor.SubLevel;
     if (spiSD != null)
     {
         this.spiSD = env.NewSpiSD();
         try
         {
             byte[] b = new byte[spiSD.GetRequiredBufferSize()];
             spiSD.WriteStruct(b, 0);
             this.spiSD.ReadStruct(b, 0);
         }
         catch (NmqiException)
         {
         }
     }
     this.spiCall = spiCall;
 }
Ejemplo n.º 3
0
 public static IBM.WMQ.Nmqi.Hobj GetHobj(NmqiEnvironment env, ManagedHobj localhobj)
 {
     if (localhobj == null)
     {
         return(new ManagedHobj(env));
     }
     switch (localhobj.value_)
     {
     case 0:
     case -1:
         return(new ManagedHobj(env));
     }
     return(localhobj);
 }
Ejemplo n.º 4
0
        public void SetIdentifier(MQProxyQueue proxyQueue, ManagedHobj hobj, int opOpts, int defRA)
        {
            uint method = 0x605;

            this.TrEntry(method, new object[] { proxyQueue, hobj.Value, opOpts, defRA });
            try
            {
                this.synchornize.Acquire();
                proxyQueue.SetIdentifier(hobj, opOpts, defRA);
                if (this.proxyQueues.ContainsKey(hobj.Handle))
                {
                    this.proxyQueues[hobj.Handle] = proxyQueue;
                }
                else
                {
                    this.proxyQueues.Add(hobj.Handle, proxyQueue);
                }
            }
            finally
            {
                this.synchornize.Release();
                base.TrExit(method);
            }
        }
Ejemplo n.º 5
0
        public bool Reconnect(ManagedHconn remoteHconn)
        {
            uint method = 0x4c3;

            this.TrEntry(method, new object[] { remoteHconn });
            int compCode = 0;
            int reason   = 0;

            try
            {
                Phconn pHconn = base.env.NewPhconn();
                remoteHconn.UnsetStarted();
                remoteHconn.GlobalMessageIndex = 0;
                base.TrText(method, string.Concat(new object[] { "Hconn : ", remoteHconn.Value, " ReconnectionID : ", remoteHconn.ConnectionId }));
                remoteHconn.NmqiConnectionOptions.ReconnectionID = remoteHconn.ConnectionId;
                try
                {
                    remoteHconn.DriveEventsEH(0, 0x9f0);
                }
                catch (Exception exception)
                {
                    base.TrException(method, exception);
                }
                try
                {
                    if (remoteHconn.NmqiConnectionOptions.RemoteQmidAsString == null)
                    {
                        remoteHconn.NmqiConnectionOptions.RemoteQmidAsString = remoteHconn.Uid;
                    }
                    base.TrText(method, string.Concat(new object[] { "Hconn : ", remoteHconn.Value, " RemoteQmidAsString : ", remoteHconn.NmqiConnectionOptions.RemoteQmidAsString }));
                }
                catch (NmqiException exception2)
                {
                    base.TrException(method, exception2, 1);
                    remoteHconn.SetReconnectionFailure(2, 0x9f4, exception2);
                    return(false);
                }
                string name = null;
                try
                {
                    name = remoteHconn.OriginalQueueManagerName;
                    base.TrText(method, string.Concat(new object[] { "Hconn : ", remoteHconn.Value, " OriginalQueueManagerName : ", name }));
                }
                catch (NmqiException exception3)
                {
                    base.TrException(method, exception3, 2);
                }
                MQFAP getMQFAP = remoteHconn.GetMQFAP;
                try
                {
                    getMQFAP.NmqiConnect(name, remoteHconn.NmqiConnectionOptions, remoteHconn.ConnectionOptions, remoteHconn.Parent, pHconn, out compCode, out reason, remoteHconn);
                    base.TrText(method, string.Concat(new object[] { "NmqiConnect during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                    if (compCode != 0)
                    {
                        return(false);
                    }
                }
                catch (MQException exception4)
                {
                    base.TrException(method, exception4, 3);
                    if ((exception4.CompCode != 0) && (exception4.Reason == 0x9f2))
                    {
                        remoteHconn.SetReconnectionFailure(2, 0x9f2, null);
                    }
                    return(false);
                }
                catch (Exception exception5)
                {
                    base.TrException(method, exception5, 4);
                    return(false);
                }
                if (remoteHconn.InTransaction())
                {
                    remoteHconn.SetTransactionDoomed();
                }
                remoteHconn.UnSetQuiescing();
                foreach (ManagedHobj hobj in remoteHconn.Hobjs)
                {
                    if (hobj.ParentHsub == null)
                    {
                        Phobj manHobj              = base.env.NewPhobj();
                        MQObjectDescriptor mqod    = hobj.Mqod;
                        Hobj           hOBJ        = manHobj.HOBJ;
                        SpiOpenOptions spiOpenOpts = hobj.SpiOpenOpts;
                        base.TrText(method, "Reopening " + mqod.ObjectName);
                        base.TrText(method, "Original name " + hobj.OriginalObjectName);
                        getMQFAP.nmqiOpen(remoteHconn, ref mqod, ref spiOpenOpts, hobj.OpenOptions, ref manHobj, out compCode, out reason, hobj.SpiCall, hobj);
                        base.TrText(method, string.Concat(new object[] { "MQOPEN during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                        if (((reason == 0x825) || (reason == 0x827)) && !hobj.OriginalObjectName.Equals(mqod.ObjectName))
                        {
                            string objectName   = mqod.ObjectName;
                            string dynamicQName = mqod.DynamicQName;
                            compCode          = 0;
                            reason            = 0;
                            mqod.ObjectName   = hobj.OriginalObjectName;
                            mqod.DynamicQName = objectName;
                            getMQFAP.MQOPEN(remoteHconn, ref mqod, hobj.OpenOptions, manHobj, out compCode, out reason, hobj);
                            base.TrText(method, string.Concat(new object[] { "MQOPEN during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                            mqod.ObjectName   = objectName;
                            mqod.DynamicQName = dynamicQName;
                        }
                        if (reason != 0)
                        {
                            remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                            return(false);
                        }
                        if (hobj.IsCallbackRegistered)
                        {
                            int operationP = 0x100;
                            if (hobj.IsCallbackSuspended)
                            {
                                operationP |= 0x10000;
                            }
                            MQCBD callbackDescriptor = hobj.CallbackDescriptor;
                            Hobj  hobjP = hobj;
                            MQMessageDescriptor callbackMessageDescriptor = hobj.CallbackMessageDescriptor;
                            MQGetMessageOptions callbackGetMessageOptions = hobj.CallbackGetMessageOptions;
                            getMQFAP.MQCB(remoteHconn, operationP, callbackDescriptor, hobjP, callbackMessageDescriptor, callbackGetMessageOptions, out compCode, out reason);
                            base.TrText(method, string.Concat(new object[] { "MQCB during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                            if (reason != 0)
                            {
                                remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                                return(false);
                            }
                        }
                    }
                }
                foreach (ManagedHsub hsub in remoteHconn.Hsbjs)
                {
                    int options = hsub.Mqsd.Options;
                    if ((options & 1) != 0)
                    {
                        options |= 2;
                    }
                    if ((options & 0x20) == 0)
                    {
                        options |= 0x400000;
                    }
                    if (((options & 8) != 0) && ((options & 6) != 0))
                    {
                        options |= 6;
                    }
                    hsub.Mqsd.Options = options;
                    Phobj pHsub = base.env.NewPhobj();
                    Phobj pHobj = base.env.NewPhobj();
                    if (hsub.Mqsd.SubExpiry != -1)
                    {
                        hsub.Mqsd.SubExpiry = hsub.GeExpiryRemainder();
                    }
                    getMQFAP.nmqiSubscribe(remoteHconn, hsub.Mqsd, ref pHobj, ref pHsub, out compCode, out reason, hsub.SpiSD, hsub.SpiCall, hsub);
                    base.TrText(method, string.Concat(new object[] { "MQSUB during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                    if (reason != 0)
                    {
                        if (!ManagedHconn.IsReconnectableReasonCode(reason) && (reason != 0x97d))
                        {
                            remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                        }
                        return(false);
                    }
                    ManagedHobj hobj3 = hsub.Hobj;
                    if (((hobj3 != null) && (hobj3.ProxyQueue != null)) && hobj3.IsCallbackRegistered)
                    {
                        int num6 = 0x100;
                        if (hobj3.IsCallbackSuspended)
                        {
                            num6 |= 0x10000;
                        }
                        MQCBD pCallbackDesc             = hobj3.CallbackDescriptor;
                        Hobj  hobj4                     = hobj3;
                        MQMessageDescriptor pMsgDescP   = hobj3.CallbackMessageDescriptor;
                        MQGetMessageOptions getMsgOptsP = hobj3.CallbackGetMessageOptions;
                        getMQFAP.MQCB(remoteHconn, num6, pCallbackDesc, hobj4, pMsgDescP, getMsgOptsP, out compCode, out reason);
                        base.TrText(method, string.Concat(new object[] { "MQCB during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                        if (reason != 0)
                        {
                            remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                            return(false);
                        }
                    }
                }
                if (remoteHconn.IsEventRegistered)
                {
                    int num7 = 0x100;
                    if (remoteHconn.IsEventSuspended)
                    {
                        num7 |= 0x10000;
                    }
                    getMQFAP.MQCB(remoteHconn, num7, remoteHconn.GetEventDescriptor(), base.env.NewPhobj().HOBJ, null, null, out compCode, out reason);
                    base.TrText(method, string.Concat(new object[] { "MQCB during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                    if (reason != 0)
                    {
                        if (!ManagedHconn.IsReconnectableReasonCode(reason))
                        {
                            remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                        }
                        return(false);
                    }
                }
                if (remoteHconn.IsCallbackStarted())
                {
                    MQCTLO pControlOpts = base.env.NewMQCTLO();
                    getMQFAP.MQCTL(remoteHconn, 1, pControlOpts, out compCode, out reason);
                    base.TrText(method, string.Concat(new object[] { "MQCTL during reconnect completed with CompCode = ", compCode, " Reason = ", reason }));
                    if (reason != 0)
                    {
                        if (!ManagedHconn.IsReconnectableReasonCode(reason))
                        {
                            remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                        }
                        return(false);
                    }
                    if (remoteHconn.IsCallbackSuspended())
                    {
                        getMQFAP.MQCTL(remoteHconn, 0x10000, pControlOpts, out compCode, out reason);
                        if (reason != 0)
                        {
                            if (!ManagedHconn.IsReconnectableReasonCode(reason))
                            {
                                remoteHconn.SetReconnectionFailure(2, 0x9f4, new NmqiException(base.env, -1, null, compCode, reason, null));
                            }
                            return(false);
                        }
                    }
                    remoteHconn.WakeDispatchThread();
                }
            }
            finally
            {
                base.TrExit(method, true, 11);
            }
            return(true);
        }
Ejemplo n.º 6
0
 public ManagedHobj(NmqiEnvironment env, int hSub, ManagedHobj hObj) : base(env)
 {
     base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { env, hSub, hObj });
     this.value_    = hSub;
     this.localHobj = hObj;
 }