Skip to content

Commit 89c8c17

Browse files
author
guyplusplus
committed
clear config names
1 parent fec104a commit 89c8c17

File tree

1 file changed

+4
-3
lines changed
  • src/test/java/com/geckotechnology/simpleCircuitBreaker

1 file changed

+4
-3
lines changed

src/test/java/com/geckotechnology/simpleCircuitBreaker/DemoApp.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public class DemoApp {
99

1010
private static final Random rd = new Random(System.currentTimeMillis());
1111
private static final int NB_THREADS = 5;
12-
private static final float ACTUAL_FAILURE_RATIO = 70;
12+
private static final float ACTUAL_FAILURE_RATIO_RANGE_PCT = 70;
13+
private static final long ACTUAL_CALL_DURATION_RANGE_MS = 1500;
1314
private static final long WAIT_BETWEEN_LOOP_MS = 500;
1415

1516
private CircuitBreaker circuitBreaker;
@@ -53,8 +54,8 @@ public void test() {
5354
public void run() {
5455
while(true) {
5556
if(circuitBreaker.isClosedForThisCall()) {
56-
boolean willFail = (rd.nextInt(1000) > 10 * ACTUAL_FAILURE_RATIO);
57-
long duration = rd.nextInt(1500);
57+
boolean willFail = (rd.nextInt(1000) > 10 * ACTUAL_FAILURE_RATIO_RANGE_PCT);
58+
long duration = rd.nextInt((int)ACTUAL_CALL_DURATION_RANGE_MS);
5859
if(willFail) {
5960
System.out.println("[" + threadId.get() + "] Breaker is closed. Simulating callFailed with duration: " + duration);
6061
TestUtils.sleep(duration);

0 commit comments

Comments
 (0)