public TestSemaphoreCommand(TestCircuitBreaker circuitBreaker, TryableSemaphore semaphore, TimeSpan executionSleep) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter() .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore), ExecutionSemaphore = semaphore, }) { this.executionSleep = executionSleep; }
/// <summary> /// /// </summary> /// <param name="circuitBreaker"></param> /// <param name="semaphore"></param> /// <param name="startLatch">this command calls {@link java.util.concurrent.CountDownLatch#countDown()} immediately upon running</param> /// <param name="waitLatch">this command calls {@link java.util.concurrent.CountDownLatch#await()} once it starts to run. The caller can use the latch to signal the command to finish</param> public LatchedSemaphoreCommand(TestCircuitBreaker circuitBreaker, TryableSemaphore semaphore, CountdownEvent startLatch, CountdownEvent waitLatch) : base(new TestCommandBuilder() { CircuitBreaker = circuitBreaker, Metrics = circuitBreaker.Metrics, CommandPropertiesDefaults = UnitTestSetterFactory.GetCommandPropertiesSetter() .WithExecutionIsolationStrategy(ExecutionIsolationStrategy.Semaphore), ExecutionSemaphore = semaphore, }) { this.startLatch = startLatch; this.waitLatch = waitLatch; }