prateekm commented on a change in pull request #981: SAMZA-2152 : Bugfix: Making KafkaSytemAdmin's metadataConsumer accesses thread-safe, enabling StreamRegexMonitors only when required URL: https://github.com/apache/samza/pull/981#discussion_r271392441
########## File path: samza-kafka/src/main/java/org/apache/samza/system/kafka/KafkaSystemAdmin.java ########## @@ -231,11 +231,13 @@ public String getUpcomingOffset() { streamNames.forEach(streamName -> { Map<Partition, SystemStreamMetadata.SystemStreamPartitionMetadata> partitionMetadata = new HashMap<>(); - List<PartitionInfo> partitionInfos = metadataConsumer.partitionsFor(streamName); - LOG.debug("Stream {} has partitions {}", streamName, partitionInfos); - - partitionInfos.forEach(partitionInfo -> partitionMetadata.put(new Partition(partitionInfo.partition()), dummySspm)); + synchronized (metadataConsumer) { + List<PartitionInfo> partitionInfos = metadataConsumer.partitionsFor(streamName); + LOG.debug("Stream {} has partitions {}", streamName, partitionInfos); + partitionInfos.forEach( Review comment: Can move out of synchronized. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services