Repository: apache/kafka
File: trogdor/src/test/java/org/apache/kafka/trogdor/common/MiniTrogdorCluster.java (Java)

Code before:
            for (String agentName : agentNames) {
                NodeData node = getOrCreate(agentName, nodes);
                node.agentRestResource = new AgentRestResource();
                node.agentRestServer = new JsonRestServer(0);
                node.agentRestServer.start(node.agentRestResource);
                node.agentPort = node.agentRestServer.port();
            }
            if (coordinatorName != null) {
                NodeData node = getOrCreate(coordinatorName, nodes);
                node.coordinatorRestResource = new CoordinatorRestResource();
                node.coordinatorRestServer = new JsonRestServer(0);
                node.coordinatorRestServer.start(node.coordinatorRestResource);
                node.coordinatorPort = node.coordinatorRestServer.port();
            }
            for (Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                NodeData node = entry.getValue();
                HashMap<String, String> config = new HashMap<>();
                if (node.agentPort != 0) {
                    config.put(Platform.Config.TROGDOR_AGENT_PORT,
                        Integer.toString(node.agentPort));
                }
                if (node.coordinatorPort != 0) {
                    config.put(Platform.Config.TROGDOR_COORDINATOR_PORT,
                        Integer.toString(node.coordinatorPort));
                }
                node.node = new BasicNode(entry.getKey(), node.hostname, config,
                    Set.of());
            }
            TreeMap<String, Node> topologyNodes = new TreeMap<>();
            for (Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                topologyNodes.put(entry.getKey(), entry.getValue().node);
            }
            final BasicTopology topology = new BasicTopology(topologyNodes);
            ScheduledExecutorService executor = Executors.newScheduledThreadPool(1,
                ThreadUtils.createThreadFactory("MiniTrogdorClusterStartupThread%d", false));
            final AtomicReference<Exception> failure = new AtomicReference<>(null);
            for (final Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                executor.submit((Callable<Void>) () -> {
                    String nodeName = entry.getKey();
                    try {
                        NodeData node = entry.getValue();
                        node.platform = new BasicPlatform(nodeName, topology, scheduler, commandRunner);
                        if (node.agentRestResource != null) {
                            node.agent = new Agent(node.platform, scheduler, node.agentRestServer,
                                node.agentRestResource);
                        }
                        if (node.coordinatorRestResource != null) {
                            node.coordinator = new Coordinator(node.platform, scheduler,
                                node.coordinatorRestServer, node.coordinatorRestResource, 0);
                        }
                    } catch (Exception e) {

Review comment (suggestion):
```java
node.node = new BasicNode(entry.getKey(), node.hostname, config, Set.of());
```

Code after:
            for (String agentName : agentNames) {
                NodeData node = getOrCreate(agentName, nodes);
                node.agentRestResource = new AgentRestResource();
                node.agentRestServer = new JsonRestServer(0);
                node.agentRestServer.start(node.agentRestResource);
                node.agentPort = node.agentRestServer.port();
            }
            if (coordinatorName != null) {
                NodeData node = getOrCreate(coordinatorName, nodes);
                node.coordinatorRestResource = new CoordinatorRestResource();
                node.coordinatorRestServer = new JsonRestServer(0);
                node.coordinatorRestServer.start(node.coordinatorRestResource);
                node.coordinatorPort = node.coordinatorRestServer.port();
            }
            for (Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                NodeData node = entry.getValue();
                HashMap<String, String> config = new HashMap<>();
                if (node.agentPort != 0) {
                    config.put(Platform.Config.TROGDOR_AGENT_PORT,
                        Integer.toString(node.agentPort));
                }
                if (node.coordinatorPort != 0) {
                    config.put(Platform.Config.TROGDOR_COORDINATOR_PORT,
                        Integer.toString(node.coordinatorPort));
                }
                node.node = new BasicNode(entry.getKey(), node.hostname, config, Set.of());
            }
            TreeMap<String, Node> topologyNodes = new TreeMap<>();
            for (Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                topologyNodes.put(entry.getKey(), entry.getValue().node);
            }
            final BasicTopology topology = new BasicTopology(topologyNodes);
            ScheduledExecutorService executor = Executors.newScheduledThreadPool(1,
                ThreadUtils.createThreadFactory("MiniTrogdorClusterStartupThread%d", false));
            final AtomicReference<Exception> failure = new AtomicReference<>(null);
            for (final Map.Entry<String, NodeData> entry : nodes.entrySet()) {
                executor.submit((Callable<Void>) () -> {
                    String nodeName = entry.getKey();
                    try {
                        NodeData node = entry.getValue();
                        node.platform = new BasicPlatform(nodeName, topology, scheduler, commandRunner);
                        if (node.agentRestResource != null) {
                            node.agent = new Agent(node.platform, scheduler, node.agentRestServer,
                                node.agentRestResource);
                        }
                        if (node.coordinatorRestResource != null) {
                            node.coordinator = new Coordinator(node.platform, scheduler,
                                node.coordinatorRestServer, node.coordinatorRestResource, 0);
                        }
                    } catch (Exception e) {
                        log.error("Unable to initialize {}", nodeName, e);