Repository: apache/kafka
File: trogdor/src/main/java/org/apache/kafka/trogdor/workload/ConnectionStressSpec.java (Java)

Code before:
 * second to stress the broker.
 */
public final class ConnectionStressSpec extends TaskSpec {
    private final List<String> clientNodes;
    private final String bootstrapServers;
    private final Map<String, String> commonClientConf;
    private final int targetConnectionsPerSec;
    private final int numThreads;
    private final ConnectionStressAction action;

    enum ConnectionStressAction {
        CONNECT,
        FETCH_METADATA
    }

    @JsonCreator
    public ConnectionStressSpec(@JsonProperty("startMs") long startMs,
            @JsonProperty("durationMs") long durationMs,
            @JsonProperty("clientNode") List<String> clientNodes,
            @JsonProperty("bootstrapServers") String bootstrapServers,
            @JsonProperty("commonClientConf") Map<String, String> commonClientConf,
            @JsonProperty("targetConnectionsPerSec") int targetConnectionsPerSec,
            @JsonProperty("numThreads") int numThreads,
            @JsonProperty("action") ConnectionStressAction action) {
        super(startMs, durationMs);
        this.clientNodes = (clientNodes == null) ? List.of() :
            List.copyOf(clientNodes);
        this.bootstrapServers = (bootstrapServers == null) ? "" : bootstrapServers;
        this.commonClientConf = configOrEmptyMap(commonClientConf);
        this.targetConnectionsPerSec = targetConnectionsPerSec;
        this.numThreads = numThreads < 1 ? 1 : numThreads;
        this.action = (action == null) ? ConnectionStressAction.CONNECT : action;
    }

    @JsonProperty
    public List<String> clientNode() {
        return clientNodes;
    }

    @JsonProperty
    public String bootstrapServers() {
        return bootstrapServers;
    }

    @JsonProperty
    public Map<String, String> commonClientConf() {
        return commonClientConf;
    }

    @JsonProperty
    public int targetConnectionsPerSec() {

Review comment (suggestion):
```java
this.clientNodes = clientNodes == null ? List.of() : List.copyOf(clientNodes);
```

Code after:
 * second to stress the broker.
 */
public final class ConnectionStressSpec extends TaskSpec {
    private final List<String> clientNodes;
    private final String bootstrapServers;
    private final Map<String, String> commonClientConf;
    private final int targetConnectionsPerSec;
    private final int numThreads;
    private final ConnectionStressAction action;

    enum ConnectionStressAction {
        CONNECT,
        FETCH_METADATA
    }

    @JsonCreator
    public ConnectionStressSpec(@JsonProperty("startMs") long startMs,
            @JsonProperty("durationMs") long durationMs,
            @JsonProperty("clientNode") List<String> clientNodes,
            @JsonProperty("bootstrapServers") String bootstrapServers,
            @JsonProperty("commonClientConf") Map<String, String> commonClientConf,
            @JsonProperty("targetConnectionsPerSec") int targetConnectionsPerSec,
            @JsonProperty("numThreads") int numThreads,
            @JsonProperty("action") ConnectionStressAction action) {
        super(startMs, durationMs);
        this.clientNodes = clientNodes == null ? List.of() : List.copyOf(clientNodes);
        this.bootstrapServers = (bootstrapServers == null) ? "" : bootstrapServers;
        this.commonClientConf = configOrEmptyMap(commonClientConf);
        this.targetConnectionsPerSec = targetConnectionsPerSec;
        this.numThreads = numThreads < 1 ? 1 : numThreads;
        this.action = (action == null) ? ConnectionStressAction.CONNECT : action;
    }

    @JsonProperty
    public List<String> clientNode() {
        return clientNodes;
    }

    @JsonProperty
    public String bootstrapServers() {
        return bootstrapServers;
    }

    @JsonProperty
    public Map<String, String> commonClientConf() {
        return commonClientConf;
    }

    @JsonProperty
    public int targetConnectionsPerSec() {
        return targetConnectionsPerSec;