Source:
<code>public void run() { Datastream datastream = _datastreamGroup.getDatastreams().get(0); <START> String bootstrapValue = String.join(KafkaConnectionString.BROKER_LIST_DELIMITER, <END> KafkaConnectionString.valueOf(datastream.getSource().getConnectionString()) .getBrokers().stream().map(KafkaBrokerAddress::toString).collect(Collectors.toList())); _consumer = createConsumer(_consumerProperties, bootstrapValue, _groupIdConstructor.constructGroupId(datastream) + DEST_CONSUMER_GROUP_ID_SUFFIX); LOG.info("Fetch thread for started", datastream.getName()); while (!isInterrupted() && !_shutdown) { try { List<String> newPartitionInfo = getPartitionsInfo(); LOG.debug("Fetch partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); if (!ListUtils.isEqualList(newPartitionInfo, _subscribedPartitions)) { LOG.info("get updated partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); _subscribedPartitions = Collections.synchronizedList(newPartitionInfo); _initialized = true; _partitionChangeCallback.accept(_datastreamGroup); } Thread.sleep(_partitionFetchIntervalMs); } catch (Throwable t) { LOG.error("detect error for thread " + datastream.getName() + ", ex: ", t); } } if (_consumer != null) { _consumer.close(); } _consumer = null; LOG.info("Fetch thread for stopped", datastream.getName()); }</code><technical_language>stream() .map(KafkaBrokerAddress::toString) .collect(Collectors.joining(KafkaConnectionString.BROKER_LIST_DELIMITER)); instead of String.join wrap Stream call chain</technical_language>

Target:
public void run() { Datastream datastream = _datastreamGroup.getDatastreams().get(0); String bootstrapValue = KafkaConnectionString.valueOf(datastream.getSource().getConnectionString()) .getBrokers().stream() .map(KafkaBrokerAddress::toString) .collect(Collectors.joining(KafkaConnectionString.BROKER_LIST_DELIMITER)); Consumer<?, ?> consumer = createConsumer(_consumerProperties, bootstrapValue, _groupIdConstructor.constructGroupId(datastream) + DEST_CONSUMER_GROUP_ID_SUFFIX); LOG.info("Fetch thread for started", _datastreamGroup.getName()); while (!isInterrupted() && !_shutdown) { try { List<String> newPartitionInfo = getPartitionsInfo(consumer); LOG.debug("Fetch partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); if (!ListUtils.isEqualList(newPartitionInfo, _subscribedPartitions)) { LOG.info("get updated partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); _subscribedPartitions = Collections.synchronizedList(newPartitionInfo); _initialized = true; _partitionChangeCallback.accept(_datastreamGroup); } Thread.sleep(_partitionFetchIntervalMs); } catch (Throwable t) { LOG.warn("detect error for thread " + _datastreamGroup.getName() + ", ex: ", t); _dynamicMetricsManager.createOrUpdateMeter(MODULE, _datastreamGroup.getName(), NUM_PARTITION_FETCH_ERRORS, 1); } } if (consumer != null) { consumer.close(); } consumer = null; LOG.info("PartitionDiscoveryThread for stopped", _datastreamGroup.getName()); }