Пример #1
0
 internal void AddClient(string address, iExchange.Common.AppType appType)
 {
     lock (_mutex)
     {
         if (_disconnectedClientManager.Contains(address) && appType == iExchange.Common.AppType.TransactionServer)
         {
             return;
         }
         _disconnectedClientManager.Remove(address);
         if (_clientDict.ContainsKey(address))
         {
             return;
         }
         try
         {
             var client = CreateClient(address, appType);
             if (client == null)
             {
                 return;
             }
             Logger.InfoFormat("add client url = {0}", address);
             this.AddClient(client);
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
         }
     }
 }
Пример #2
0
 internal void Add(string url, iExchange.Common.AppType appType)
 {
     lock (_mutex)
     {
         if (!_clients.ContainsKey(url))
         {
             _clients.Add(url, new ClientInfo(appType));
         }
     }
 }
Пример #3
0
 private static ClientBase CreateClient(string address, iExchange.Common.AppType appType)
 {
     try
     {
         var channel = CreateChannel(address);
         return(ClientFactory.Create(channel, address, appType));
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(null);
     }
 }
Пример #4
0
 private static ClientBase CreateClientAndTest(string address, iExchange.Common.AppType appType)
 {
     try
     {
         var channel = CreateChannel(address);
         channel.Test();
         return(ClientFactory.Create(channel, address, appType));
     }
     catch (Exception ex)
     {
         Logger.ErrorFormat("CreateClientAndTest address = {0}, appType = {1}, error= {2}", address, appType, ex);
         return(null);
     }
 }
Пример #5
0
 internal ClientInfo(iExchange.Common.AppType appType)
 {
     this.AppType           = appType;
     this.TryConnectedCount = 0;
 }
Пример #6
0
 internal void AddClient(string address, iExchange.Common.AppType appType)
 {
     _clientManager.AddClient(address, appType);
 }
Пример #7
0
 internal static ClientBase Create(ICommandCollectService service, string url, iExchange.Common.AppType appType)
 {
     if (appType == iExchange.Common.AppType.TransactionServer)
     {
         return(new TransactionClient(service, url, appType));
     }
     return(new Client(service, url, appType));
 }
Пример #8
0
 internal TransactionClient(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
     : base(service, serviceUrl, appType)
 {
     _commandManager = new CommandManager(this);
 }
Пример #9
0
 internal Client(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
     : base(service, serviceUrl, appType)
 {
     _actionBlock = new ActionBlock <Command>((Action <Command>) this.SendCommandHandle);
 }
Пример #10
0
 protected ClientBase(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
 {
     _service    = service;
     _serviceUrl = serviceUrl;
     _appType    = appType;
 }
Пример #11
0
 public void Register(string address, iExchange.Common.AppType appType)
 {
     this.Call(() => this.Service.Register(address, appType));
 }
Пример #12
0
 public void Register(string address, iExchange.Common.AppType appType)
 {
     base.Channel.Register(address, appType);
 }