Exemplo n.º 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);
         }
     }
 }
Exemplo n.º 2
0
 internal void Add(string url, iExchange.Common.AppType appType)
 {
     lock (_mutex)
     {
         if (!_clients.ContainsKey(url))
         {
             _clients.Add(url, new ClientInfo(appType));
         }
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 5
0
 internal ClientInfo(iExchange.Common.AppType appType)
 {
     this.AppType           = appType;
     this.TryConnectedCount = 0;
 }
Exemplo n.º 6
0
 internal void AddClient(string address, iExchange.Common.AppType appType)
 {
     _clientManager.AddClient(address, appType);
 }
Exemplo n.º 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));
 }
Exemplo n.º 8
0
 internal TransactionClient(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
     : base(service, serviceUrl, appType)
 {
     _commandManager = new CommandManager(this);
 }
Exemplo n.º 9
0
 internal Client(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
     : base(service, serviceUrl, appType)
 {
     _actionBlock = new ActionBlock <Command>((Action <Command>) this.SendCommandHandle);
 }
Exemplo n.º 10
0
 protected ClientBase(ICommandCollectService service, string serviceUrl, iExchange.Common.AppType appType)
 {
     _service    = service;
     _serviceUrl = serviceUrl;
     _appType    = appType;
 }
Exemplo n.º 11
0
 public void Register(string address, iExchange.Common.AppType appType)
 {
     this.Call(() => this.Service.Register(address, appType));
 }
Exemplo n.º 12
0
 public void Register(string address, iExchange.Common.AppType appType)
 {
     base.Channel.Register(address, appType);
 }