1 package com.griddynamics.jagger.user.test.configurations.load;
3 import com.griddynamics.jagger.user.test.configurations.load.auxiliary.TransactionsPerSecond;
5 import java.util.Objects;
24 private final long transactionsPerSecond;
25 private final long maxLoadThreads;
26 private final long warmUpTimeInMilliseconds;
27 private final int tickInterval;
30 Objects.requireNonNull(builder);
32 this.transactionsPerSecond = builder.transactionsPerSecond;
33 this.maxLoadThreads = builder.maxLoadThreads;
34 this.warmUpTimeInMilliseconds = builder.warmUpTimeInMilliseconds;
35 this.tickInterval = builder.tickInterval;
45 return new Builder(transactionsPerSecond);
49 static final int DEFAULT_TICK_INTERVAL = 1000;
50 static final int DEFAULT_MAX_LOAD_THREADS = 500;
51 static final int DEFAULT_WARM_UP_TIME = -1;
52 private final long transactionsPerSecond;
53 private long maxLoadThreads;
54 private long warmUpTimeInMilliseconds;
57 private int tickInterval;
66 Objects.requireNonNull(transactionsPerSecond);
68 this.transactionsPerSecond = transactionsPerSecond.
value();
69 this.maxLoadThreads = DEFAULT_MAX_LOAD_THREADS;
70 this.warmUpTimeInMilliseconds = DEFAULT_WARM_UP_TIME;
71 this.tickInterval = DEFAULT_TICK_INTERVAL;
85 if (maxLoadThreads <= 0) {
86 throw new IllegalArgumentException(String.format(
"The maximum number of threads must be > 0. Provided value is %s", maxLoadThreads));
88 this.maxLoadThreads = maxLoadThreads;
96 if (warmUpTimeInMilliseconds < 0) {
97 throw new IllegalArgumentException(
98 String.format(
"The warm up time value in milliseconds. must be >= 0. Provided value is %s", warmUpTimeInMilliseconds));
100 this.warmUpTimeInMilliseconds = warmUpTimeInMilliseconds;
106 return transactionsPerSecond;
110 return maxLoadThreads;
114 return warmUpTimeInMilliseconds;