Skip to content

Commit b127087

Browse files
committed
Remove unused constructor, fix types
- Use "long" for numRecords and warmupRecords instead of "Long" - Remove "* != null" for above - Remove unused "combiner" constructor
1 parent b0a6c20 commit b127087

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -409,26 +409,6 @@ public Stats(long numRecords, int reportingInterval, boolean isSteadyState) {
409409
this.steadyStateActive = isSteadyState;
410410
}
411411

412-
Stats(Stats first, Stats second) {
413-
// create a Stats object that's the combination of two disjoint Stats objects
414-
this.start = Math.min(first.start, second.start);
415-
this.iteration = first.iteration + second.iteration;
416-
this.sampling = first.sampling;
417-
this.index = first.index() + second.index();
418-
this.latencies = Arrays.copyOf(first.latencies, this.index);
419-
System.arraycopy(second.latencies, 0, this.latencies, first.index(), second.index());
420-
this.maxLatency = Math.max(first.maxLatency, second.maxLatency);
421-
this.windowCount = first.windowCount + second.windowCount;
422-
this.windowMaxLatency = 0;
423-
this.windowTotalLatency = 0;
424-
this.totalLatency = first.totalLatency + second.totalLatency;
425-
this.reportingInterval = first.reportingInterval;
426-
this.isSteadyState = false; // false except in the steady-state case
427-
this.count = first.count + second.count;
428-
this.bytes = first.bytes + second.bytes;
429-
this.steadyStateActive = false;
430-
}
431-
432412
public void record(int latency, int bytes, long time) {
433413
this.count++;
434414
this.bytes += bytes;
@@ -564,8 +544,8 @@ public void onCompletion(RecordMetadata metadata, Exception exception) {
564544

565545
static final class ConfigPostProcessor {
566546
final String topicName;
567-
final Long numRecords;
568-
final Long warmupRecords;
547+
final long numRecords;
548+
final long warmupRecords;
569549
final Integer recordSize;
570550
final double throughput;
571551
final boolean payloadMonotonic;
@@ -590,10 +570,10 @@ public ConfigPostProcessor(ArgumentParser parser, String[] args) throws IOExcept
590570
String payloadFilePath = namespace.getString("payloadFile");
591571
Long transactionDurationMsArg = namespace.getLong("transactionDurationMs");
592572
String transactionIdArg = namespace.getString("transactionalId");
593-
if (numRecords != null && numRecords <= 0) {
573+
if (numRecords <= 0) {
594574
throw new ArgumentParserException("--num-records should be greater than zero", parser);
595575
}
596-
if (warmupRecords != null && warmupRecords >= numRecords) {
576+
if (warmupRecords >= numRecords) {
597577
throw new ArgumentParserException("The value for --warmup-records must be strictly fewer than the number of records in the test, --num-records.", parser);
598578
}
599579
if (recordSize != null && recordSize <= 0) {

0 commit comments

Comments
 (0)