Exemple #1
0
 internal SemaphoreIsolationCommand(string instanceKey, string commandKey, string groupKey, string domain, Action <ICommandConfigSet> config, bool hasFallback)
     : base(instanceKey, commandKey, groupKey, domain, config)
 {
     ExecutionSemaphore = ExecutionSemaphores.GetOrAdd(Key, key => new IsolationSemaphore(ConfigSet.CommandMaxConcurrentCount));
     if (hasFallback || HasFallback)
     {
         FallbackExecutionSemaphore = FallbackExecutionSemaphores.GetOrAdd(Key, key => new IsolationSemaphore(ConfigSet.FallbackMaxConcurrentCount));
     }
 }
Exemple #2
0
        internal ThreadIsolationCommand(string instanceKey, string commandKey, string groupKey, string domain, Action <ICommandConfigSet> config, bool hasFallback)
            : base(instanceKey, commandKey, groupKey, domain, config)
        {
            if (hasFallback || HasFallback)
            {
                FallbackExecutionSemaphore = FallbackExecutionSemaphores.GetOrAdd(Key, key => new IsolationSemaphore(ConfigSet.FallbackMaxConcurrentCount));
            }

            ConfigSet.SubcribeConfigChangeEvent((cf) =>
            {
                this.UpdateMaxConcurrentCount(cf.CommandMaxConcurrentCount);
                this.UpdateCommandTimeoutInMilliseconds(cf.CommandTimeoutInMilliseconds);
            });
        }