Beispiel #1
0
        /// <summary>
        /// Initialises a new Throttle class with a nested resiliency pattern invoker.
        /// </summary>
        /// <param name="limit">The maximum concurrent executions.</param>
        /// <param name="nestedInvoker">The invoker to pass the command onto.</param>
        public Throttle(int limit, ResiliencyCommandInvoker nestedInvoker)
        {
            if (limit < 1)
            {
                throw new ArgumentOutOfRangeException("limit", "The limit cannot be less than one.");
            }

            this.semaphore = new SemaphoreSuperSlim(limit);
            this.invoker   = nestedInvoker;
        }
 internal CircuitBreakerStateAttempt(CircuitBreakerStateParameters parameters)
 {
     this.parameters = parameters;
     this.semaphore  = new SemaphoreSuperSlim(1);
 }