コード例 #1
0
        internal bool EligibleForReconnect(ManagedHconn remoteHconn, MQSession remoteSession, bool register)
        {
            uint method = 0x4eb;

            this.TrEntry(method, new object[] { remoteHconn, remoteSession, register });
            bool result = true;

            try
            {
                lock (this.reconnectMutex)
                {
                    if (register)
                    {
                        if (remoteHconn.IsReconnectable && !remoteHconn.HasFailed())
                        {
                            MQSession session = remoteHconn.Session;
                            if ((remoteSession == session) && remoteHconn.InitializeForReconnect())
                            {
                                this.hconns.Add(remoteHconn);
                                Monitor.PulseAll(this.reconnectMutex);
                            }
                            return(result);
                        }
                        return(false);
                    }
                    remoteHconn.IsReconnectable = false;
                    return(result);
                }
            }
            finally
            {
                base.TrExit(method, result);
            }
            return(result);
        }
コード例 #2
0
        public void Run()
        {
            uint method = 0x4c1;

            this.TrEntry(method);
            Thread.CurrentThread.Name = "ReconnectThread";
            Thread.SetData(Thread.GetNamedDataSlot("MQ_CLIENT_THREAD_TYPE"), 3);
            try
            {
                while (true)
                {
                    ManagedHconn remoteHconn = this.BestHconn();
                    base.TrText(method, "Hconn found for reconnection = " + remoteHconn.Value);
                    if (this.Reconnect(remoteHconn))
                    {
                        this.ReconnectionComplete(remoteHconn);
                        base.TrText(method, "Reconnection Completed");
                    }
                    else if (remoteHconn.HasFailed())
                    {
                        this.ReleaseHconn(remoteHconn);
                    }
                    else
                    {
                        remoteHconn.ReconnectionAttempts++;
                        int index = remoteHconn.ReconnectionAttempts - 1;
                        if (index >= this.rcnTimes.Length)
                        {
                            index = this.rcnTimes.Length - 1;
                        }
                        remoteHconn.NextReconnect = NmqiTools.GetCurrentTimeInMs() + Convert.ToInt64(this.rcnTimes[index]);
                        base.TrText(method, string.Concat(new object[] { "Reconnection details: Hconn : ", remoteHconn.Value, " Reconnection times : ", remoteHconn.ReconnectionAttempts, "NextReconnectionTime : ", remoteHconn.NextReconnect }));
                    }
                }
            }
            catch (Exception exception)
            {
                base.TrException(method, exception);
                CommonServices.SetValidInserts();
                CommonServices.ArithInsert1   = 1;
                CommonServices.CommentInsert1 = "ReconnectThread::Run";
                CommonServices.CommentInsert2 = exception.Message;
                CommonServices.CommentInsert3 = exception.StackTrace;
                base.FFST("%Z% %W%  %I% %E% %U%", "%C%", method, 1, 0x20009546, 0);
            }
            finally
            {
                Thread.SetData(Thread.GetNamedDataSlot("MQ_CLIENT_THREAD_TYPE"), 0);
                base.TrExit(method);
            }
        }
コード例 #3
0
ファイル: MQSession.cs プロジェクト: halfsilvered/TestCodes
        internal void CheckIfDisconnected()
        {
            uint method = 0x612;

            this.TrEntry(method);
            try
            {
                ManagedHconn reconnectableParent = this.ReconnectableParent;
                if (this.disconnected && ((reconnectableParent == null) || ((reconnectableParent != null) && reconnectableParent.HasFailed())))
                {
                    NmqiException ex = new NmqiException(base.env, -1, null, 2, 0x7d9, this.asyncFailure);
                    base.TrException(method, ex);
                    throw ex;
                }
            }
            finally
            {
                base.TrExit(method);
            }
        }