internal ThreadIsolationCommand(string instanceKey, string commandKey, string groupKey, string domain, Action <ICommandConfigSet> config, bool hasFallback) : base(instanceKey, commandKey, groupKey, domain, config) { Func <string, IsolationSemaphore> valueFactory = null; HandleConfigChangeDelegate handleConfigChange = null; if (hasFallback || this.HasFallback) { if (valueFactory == null) { valueFactory = key => new IsolationSemaphore(base.ConfigSet.FallbackMaxConcurrentCount); } this.FallbackExecutionSemaphore = HystrixCommandBase.FallbackExecutionSemaphores.GetOrAdd(this.Key, valueFactory); } if (handleConfigChange == null) { handleConfigChange = delegate(ICommandConfigSet cf) { ((ThreadIsolationCommand <T>) this).UpdateMaxConcurrentCount <T>(cf.CommandMaxConcurrentCount); ((ThreadIsolationCommand <T>) this).UpdateCommandTimeoutInMilliseconds <T>(cf.CommandTimeoutInMilliseconds); }; } base.ConfigSet.SubcribeConfigChangeEvent(handleConfigChange); }
public static void SubcribeConfigChangeEvent(this ICommandConfigSet configSet, HandleConfigChangeDelegate handleConfigChange) { IConfigChangeEvent event2 = configSet as IConfigChangeEvent; if (event2 != null) { event2.OnConfigChanged += handleConfigChange; } }
public static void SubcribeConfigChangeEvent(this ICommandConfigSet configSet, HandleConfigChangeDelegate handleConfigChange) { IConfigChangeEvent hasConfigChangeEvent = configSet as IConfigChangeEvent; if (hasConfigChangeEvent == null) { return; } hasConfigChangeEvent.OnConfigChanged += handleConfigChange; }