1 package com.griddynamics.jagger.user.test.configurations.load;
3 import com.griddynamics.jagger.user.test.configurations.load.auxiliary.RequestsPerSecond;
5 import java.util.Objects;
14 private final long requestsPerSecond;
15 private final long maxLoadThreads;
16 private final long warmUpTimeInSeconds;
17 private final int tickInterval;
20 Objects.requireNonNull(builder);
22 this.requestsPerSecond = builder.requestsPerSecond;
23 this.maxLoadThreads = builder.maxLoadThreads;
24 this.warmUpTimeInSeconds = builder.warmUpTimeInSeconds;
25 this.tickInterval = builder.tickInterval;
35 return new Builder(requestsPerSecond);
39 static final int DEFAULT_TICK_INTERVAL = 1000;
40 static final int DEFAULT_MAX_LOAD_THREADS = 4000;
41 static final int DEFAULT_WARM_UP_TIME = -1;
42 private final long requestsPerSecond;
43 private long maxLoadThreads;
44 private long warmUpTimeInSeconds;
47 private int tickInterval;
56 Objects.requireNonNull(requestsPerSecond);
58 this.requestsPerSecond = requestsPerSecond.
value();
59 this.maxLoadThreads = DEFAULT_MAX_LOAD_THREADS;
60 this.warmUpTimeInSeconds = DEFAULT_WARM_UP_TIME;
61 this.tickInterval = DEFAULT_TICK_INTERVAL;
75 if (maxLoadThreads <= 0) {
76 throw new IllegalArgumentException(String.format(
"The maximum number of threads must be > 0. Provided value is %s", maxLoadThreads));
78 this.maxLoadThreads = maxLoadThreads;
86 if (warmUpTimeInSeconds < 0) {
87 throw new IllegalArgumentException(
88 String.format(
"The warm up time value in seconds. must be >= 0. Provided value is %s", warmUpTimeInSeconds));
90 this.warmUpTimeInSeconds = warmUpTimeInSeconds;
96 return requestsPerSecond;
100 return maxLoadThreads;
104 return warmUpTimeInSeconds;