Пример #1
0
 internal void RemoveService(TraderServerAgent agent)
 {
     lock (_mutex)
     {
         _agentDict.Remove(agent.ServiceUrl);
         agent.CommunicateFailed -= this.RemoveService;
     }
 }
Пример #2
0
        internal void AddServices(EndpointAddress[] addresses)
        {
            lock (_mutex)
            {
                foreach (var eachAddress in addresses)
                {
                    string serviceUrl = eachAddress.Uri.ToString();
                    if (!_agentDict.ContainsKey(serviceUrl))
                    {
                        var channel = ChannelFactory <ICommandCollectService> .CreateChannel(new NetTcpBinding(SecurityMode.None), eachAddress);

                        var agent = new TraderServerAgent(channel, serviceUrl);
                        agent.CommunicateFailed += this.RemoveService;
                        _agentDict.Add(serviceUrl, agent);
                    }
                }
            }
        }