Example #1
0
 public static void RegisterMetricsPublisher(HystrixCommandExecutionHook impl)
 {
     if (!commandExecutionHook.CompareAndSet(null, impl))
     {
         throw new InvalidOperationException("Another strategy was already registered.");
     }
 }
 public TestHystrixCommand(TestCommandBuilder builder, HystrixCommandExecutionHook executionHook) :
     base(builder.owner, builder.dependencyKey, builder.threadPoolKey, builder.circuitBreaker, builder.threadPool,
          builder.commandPropertiesDefaults, builder.threadPoolPropertiesDefaults, builder.metrics,
          builder.fallbackSemaphore, builder.executionSemaphore, new TestOptionsFactory(), executionHook, null, null)
 {
     this.builder = builder;
 }
Example #3
0
        public HystrixCommand(IHystrixCommandGroupKey group, IHystrixCommandKey key, IHystrixThreadPoolKey threadPoolKey, IHystrixCircuitBreaker circuitBreaker, IHystrixThreadPool threadPool,
                              IHystrixCommandOptions commandOptionsDefaults, IHystrixThreadPoolOptions threadPoolOptionsDefaults, HystrixCommandMetrics metrics, SemaphoreSlim fallbackSemaphore, SemaphoreSlim executionSemaphore,
                              HystrixOptionsStrategy optionsStrategy, HystrixCommandExecutionHook executionHook, Action run, Action fallback, ILogger logger = null) :
            base(group, key, threadPoolKey, circuitBreaker, threadPool, commandOptionsDefaults, threadPoolOptionsDefaults, metrics, fallbackSemaphore, executionSemaphore, optionsStrategy, executionHook, null, null, logger)
        {
            if (run == null)
            {
                _run = () => Run();
            }
            else
            {
                _run = run;
            }

            if (fallback == null)
            {
                _fallback = () => RunFallback();
            }
            else
            {
                _fallback = fallback;
            }
        }