コード例 #1
0
 internal MQFAPConnectionPool(NmqiEnvironment nmqiEnv, MQFAP fap) : base(nmqiEnv)
 {
     this.allConnectionSpecs = new Hashtable();
     this.callSync           = new Lock();
     base.TrConstructor("%Z% %W% %I% %E% %U%", new object[] { nmqiEnv, fap });
     this.fap = fap;
 }
コード例 #2
0
 public MQDispatchThread(NmqiEnvironment nmqiEnv, MQFAP fap, ManagedHconn hconn) : base(nmqiEnv)
 {
     this.sleepingEventSync = new Lock();
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { nmqiEnv, fap, hconn });
     this.fap         = fap;
     this.hconn       = hconn;
     this.hconnActive = true;
 }
コード例 #3
0
 public MQManagedReconnectableThread(NmqiEnvironment env, MQFAP fap) : base(env)
 {
     this.defaultDelayTimes = new int[] { 0x3e8, 0x7d0, 0xfa0, 0x1f40, 0x3e80, 0x61a8 };
     this.reconnectMutex    = new object();
     base.TrConstructor("%Z% %W%  %I% %E% %U%", new object[] { env, fap });
     this.hconns = new ArrayList();
     this.fap    = fap;
     this.BuildReconnectionTimes();
 }
コード例 #4
0
        public NmqiMQ GetMQI(int id)
        {
            uint method = 0x2e1;

            this.TrEntry(method, new object[] { id });
            NmqiMQ instance = null;
            string name     = null;

            base.TrText(method, "Component ID Supplied -> " + id);
            switch (id)
            {
            case 0:
                name = "IBM.WMQ.Nmqi.BindingsNmqiMQ";
                break;

            case 1:
                name = "IBM.WMQ.Nmqi.UnmanagedNmqiMQ";
                break;

            case 2:
                name = "IBM.WMQ.Nmqi.MQFAP";
                break;

            case 3:
                name = "IBM.WMQ.Nmqi.XAUnmanagedNmqiMQ";
                break;

            default:
            {
                string text1 = "The id '" + id + "' was not valid";
                break;
            }
            }
            try
            {
                base.TrText(method, "Component Name -> " + name);
                lock (this.mqiCache.SyncRoot)
                {
                    instance = (NmqiMQ)this.mqiCache[name];
                    if (instance == null)
                    {
                        if (id == 2)
                        {
                            instance = new MQFAP(this);
                        }
                        else
                        {
                            instance = this.GetInstance(name);
                        }
                        this.mqiCache.Add(name, instance);
                    }
                    return(instance);
                }
                return(instance);
            }
            catch (MQException exception)
            {
                base.TrException(method, exception);
                throw;
            }
            finally
            {
                base.TrExit(method);
            }
            return(instance);
        }
コード例 #5
0
        private MQFAPConnection CreateAndConnectConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            MQFAPConnection connection;
            uint            method = 0x59a;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            try
            {
                if (mqcd == null)
                {
                    CommonServices.SetValidInserts();
                    CommonServices.CommentInsert1 = "No Channel Definition to establish connection";
                    base.FFST("%Z% %W% %I% %E% %U%", "%C%", method, 1, 0x20009519, 0);
                    NmqiException exception = new NmqiException(base.env, -1, null, 2, 0x893, null);
                    throw exception;
                }
                if (mqcd.TransportType == 2)
                {
                    connection = new MQTCPConnection(base.env, this, fap, mqcd, sslConfigOptions, this.GetConnectOptions(connectOptions));
                }
                else
                {
                    string[] inserts = new string[3];
                    inserts[2] = mqcd.TransportType.ToString();
                    NmqiException exception2 = new NmqiException(base.env, 0x26bb, inserts, 2, 0x80b, null);
                    throw exception2;
                }
                this.connectionsLock.Acquire();
                this.connectingConnections++;
                try
                {
                    MQChannelDefinition definition = connection.ClientConn.Clone();
                    definition.Version           = 11;
                    connection.NegotiatedChannel = definition;
                }
                catch (Exception exception3)
                {
                    base.TrException(method, exception3, 1);
                    NmqiException exception4 = new NmqiException(base.env, -1, null, 2, 0x8e5, null);
                    throw exception4;
                }
                connection.InitSecurityExits();
                try
                {
                    connection.Connect(mqcsp);
                }
                catch (Exception exception5)
                {
                    base.TrException(method, exception5, 2);
                    connection = null;
                    throw exception5;
                }
            }
            finally
            {
                this.connectingConnections--;
                this.connectionsLock.Release();
                this.connectionsLock.PulseAll();
                base.TrExit(method);
            }
            return(connection);
        }
コード例 #6
0
        private MQSession GetSessionFromNewConnection(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFapLevel)
        {
            uint method = 0x599;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFapLevel });
            MQFAPConnection connection = null;
            MQSession       session    = null;

            try
            {
                this.connectionsLock.Acquire();
                connection = this.CreateAndConnectConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFapLevel);
                session    = connection.AssignSession();
                session.ParentConnection = connection;
                session.InitSendReceiveExits(true);
                if (connection.GetFreeConversations() > 0)
                {
                    this.AddConnection(connection);
                }
            }
            finally
            {
                this.connectionsLock.Release();
                base.TrExit(method);
            }
            return(session);
        }
コード例 #7
0
        internal MQSession GetSession(MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, MQConnectionSecurityParameters mqcsp, MQFAP fap, string qMgrName, int connectOptions, int maxFAPLevel)
        {
            uint method = 0x598;

            this.TrEntry(method, new object[] { mqcsp, fap, qMgrName, connectOptions, maxFAPLevel });
            MQSession result = null;
            bool      flag   = CommonServices.TraceEnabled();

            try
            {
                int num2 = 0;
                for (num2 = 0; (num2 < 3) && (result == null); num2++)
                {
                    result = this.GetSessionFromEligibleConnection();
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                if (result == null)
                {
                    result = this.GetSessionFromNewConnection(mqcd, sslConfigOptions, mqcsp, fap, qMgrName, connectOptions, maxFAPLevel);
                    if ((result != null) && flag)
                    {
                        base.TrText(method, string.Concat(new object[] { "Current session(existing connection) = ", result.ConversationId, "Connection - ", result.Connection.GetHashCode() }));
                    }
                }
                result.InitOAMFlow(mqcsp);
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }
コード例 #8
0
 internal MQTCPConnection(NmqiEnvironment nmqiEnv, MQConnectionSpecification spec, MQFAP fap, MQChannelDefinition mqcd, MQSSLConfigOptions sslConfigOptions, int options) : base(nmqiEnv, spec.MQChannelDef.Clone())
 {
     this.timeout             = 0x1d4c0;
     this.timeoutChanged      = true;
     this.maxTransmissionSize = 0x7ff6;
     this.Lock = new object();
     base.TrConstructor("%Z% %W%  %I% %E% %U%");
     this.conname = mqcd.ConnectionName;
     this.nextHeartBeatSendTime = DateTime.Now.AddSeconds((double)this.timeout);
     this.localAddr             = mqcd.LocalAddress;
     cfg                       = base.env.Cfg;
     this.mqcd                 = mqcd;
     this.sslConfigOptions     = sslConfigOptions;
     base.fap                  = fap;
     base.remoteConnectionSpec = spec;
     base.connectOptions       = options;
     base.nmqiFlags            = spec.NmqiFlags;
     base.commsBufferPool      = fap.CommsBufferPool;
 }
コード例 #9
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);
        }