Beispiel #1
0
        public async Task <ServiceInfo[]> LookupAsync(ClientConfigItem clientInfo)
        {
            if (clientInfo == null)
            {
                return(null);
            }
            try
            {
                var result = await _zookeeper.LookupAsync(clientInfo.Name, clientInfo.Group);

                return(result);
            }
            catch (KeeperException ex)
            {
                if (ex.getCode() == KeeperException.Code.SESSIONEXPIRED)
                {
                    throw new SessionExpireException(ex.Message, ex);
                }

                throw new ZookeeperException(ex.Message, ex);
            }
            //catch (Exception ex)
            //{
            //	throw;
            //}
        }
Beispiel #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="clientConfigItem"></param>
 /// <returns></returns>
 protected Task <ServiceInfo[]> LookupAsync(ClientConfigItem clientConfigItem)
 {
     return(clientConfigItem == null
                         ? TaskHelper.FromResult <ServiceInfo[]>(null)
                         : LookupAsync(clientConfigItem.Name, clientConfigItem.Group));
 }