public static IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
        {
            if (threadPoolKey == null)
            {
                throw new ArgumentNullException("threadPoolKey");
            }

            IHystrixPropertiesStrategy strategy = HystrixPlugins.Instance.PropertiesStrategy;
            string cacheKey = strategy.GetThreadPoolPropertiesCacheKey(threadPoolKey, setter);

            if (String.IsNullOrEmpty(cacheKey))
            {
                return(strategy.GetThreadPoolProperties(threadPoolKey, setter));
            }
            else
            {
                return(threadPoolProperties.GetOrAdd(cacheKey, w =>
                {
                    if (setter == null)
                    {
                        setter = new HystrixThreadPoolPropertiesSetter();
                    }

                    return strategy.GetThreadPoolProperties(threadPoolKey, setter);
                }));
            }
        }
Пример #2
0
        public MockingHystrixThreadPoolProperties(HystrixThreadPoolPropertiesSetter setter)
        {
            if (setter == null)
            {
                throw new ArgumentNullException("setter");
            }

            this.setter = setter;
        }
 public string GetThreadPoolPropertiesCacheKey(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
 {
     return(null);
 }
 public IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
 {
     if (setter == null)
     {
         setter = UnitTestSetterFactory.GetThreadPoolPropertiesSetter();
     }
     return(new MockingHystrixThreadPoolProperties(setter));
 }
Пример #5
0
 public HystrixCommandSetter AndThreadPoolPropertiesDefaults(HystrixThreadPoolPropertiesSetter threadPoolPropertiesDefaults)
 {
     ThreadPoolPropertiesDefaults = threadPoolPropertiesDefaults;
     return(this);
 }
Пример #6
0
 public virtual string GetThreadPoolPropertiesCacheKey(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
 {
     return(threadPoolKey.Name);
 }
Пример #7
0
 public virtual IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
 {
     return(new HystrixThreadPoolPropertiesDefault(setter));
 }