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;
36 private final long requestsPerSecond;
37 private final long maxLoadThreads;
38 private final long warmUpTimeInMilliseconds;
39 private final int tickInterval;
42 Objects.requireNonNull(builder);
44 this.requestsPerSecond = builder.requestsPerSecond;
45 this.maxLoadThreads = builder.maxLoadThreads;
46 this.warmUpTimeInMilliseconds = builder.warmUpTimeInMilliseconds;
47 this.tickInterval = builder.tickInterval;
57 return new Builder(requestsPerSecond);
61 static final int DEFAULT_TICK_INTERVAL = 1000;
62 static final int DEFAULT_MAX_LOAD_THREADS = 500;
63 static final int DEFAULT_WARM_UP_TIME = -1;
64 private final long requestsPerSecond;
65 private long maxLoadThreads;
66 private long warmUpTimeInMilliseconds;
69 private int tickInterval;
78 Objects.requireNonNull(requestsPerSecond);
80 this.requestsPerSecond = requestsPerSecond.
value();
81 this.maxLoadThreads = DEFAULT_MAX_LOAD_THREADS;
82 this.warmUpTimeInMilliseconds = DEFAULT_WARM_UP_TIME;
83 this.tickInterval = DEFAULT_TICK_INTERVAL;
97 if (maxLoadThreads <= 0) {
98 throw new IllegalArgumentException(String.format(
"The maximum number of threads must be > 0. Provided value is %s", maxLoadThreads));
100 this.maxLoadThreads = maxLoadThreads;
108 if (warmUpTimeInMilliseconds < 0) {
109 throw new IllegalArgumentException(
110 String.format(
"The warm up time value in milliseconds. must be >= 0. Provided value is %s", warmUpTimeInMilliseconds));
112 this.warmUpTimeInMilliseconds = warmUpTimeInMilliseconds;
118 return requestsPerSecond;
122 return maxLoadThreads;
126 return warmUpTimeInMilliseconds;