public void RegisterPropertiesStrategy(IHystrixPropertiesStrategy implementation) { if (!this.propertyStrategy.CompareAndSet(null, implementation)) { throw new InvalidOperationException("Another strategy was alread registered."); } }
public static IHystrixCollapserProperties GetCollapserProperties(IHystrixCollapserKey collapserKey, HystrixCollapserPropertiesSetter setter) { if (collapserKey == null) { throw new ArgumentNullException("collapserKey"); } IHystrixPropertiesStrategy strategy = HystrixPlugins.Instance.PropertiesStrategy; string cacheKey = strategy.GetCollapserPropertiesCacheKey(collapserKey, setter); if (String.IsNullOrEmpty(cacheKey)) { return(strategy.GetCollapserProperties(collapserKey, setter)); } else { return(collapserProperties.GetOrAdd(cacheKey, w => { if (setter == null) { setter = new HystrixCollapserPropertiesSetter(); } return strategy.GetCollapserProperties(collapserKey, setter); })); } }