示例#1
0
        public void OnCommand(ITransport sender, Command command)
        {
            if (command != null)
            {
                if (command.IsResponse)
                {
                    Object oo = null;
                    lock (((ICollection)requestMap).SyncRoot)
                    {
                        int v = ((Response)command).CorrelationId;
                        try
                        {
                            if (requestMap.ContainsKey(v))
                            {
                                oo = requestMap[v];
                                requestMap.Remove(v);
                            }
                        }
                        catch
                        {
                        }
                    }

                    Tracked t = oo as Tracked;
                    if (t != null)
                    {
                        t.onResponses();
                    }
                }
            }

            this.Command(sender, command);
        }
        public void OnCommand(ITransport sender, Command command)
        {
            if (command != null)
            {
                if (command.IsResponse)
                {
                    Object oo = null;
                    lock (((ICollection)requestMap).SyncRoot)
                    {
                        int v = ((Response)command).CorrelationId;
                        try
                        {
                            if (requestMap.ContainsKey(v))
                            {
                                oo = requestMap[v];
                                requestMap.Remove(v);
                            }
                        }
                        catch
                        {
                        }
                    }

                    Tracked t = oo as Tracked;
                    if (t != null)
                    {
                        t.onResponses();
                    }
                }

                if (!initialized)
                {
                    if (command.IsBrokerInfo)
                    {
                        BrokerInfo   info  = (BrokerInfo)command;
                        BrokerInfo[] peers = info.PeerBrokerInfos;
                        if (peers != null)
                        {
                            for (int i = 0; i < peers.Length; i++)
                            {
                                String brokerString = peers[i].BrokerURL;
                                Add(brokerString);
                            }
                        }

                        initialized = true;
                    }
                }
            }

            this.Command(sender, command);
        }