chia7712 commented on code in PR #19227:
URL: https://github.com/apache/kafka/pull/19227#discussion_r2006041802


##########
core/src/main/scala/kafka/server/metadata/KRaftMetadataCache.scala:
##########
@@ -341,10 +341,10 @@ class KRaftMetadataCache(
     
Option(_currentImage.cluster.broker(brokerId)).count(_.inControlledShutdown) == 
1
   }
 
-  private def getAliveBrokers(image: MetadataImage): util.List[BrokerMetadata] 
= {
+  private def getAliveBrokers(image: MetadataImage): util.List[UsableBroker] = 
{

Review Comment:
   we should inline this method. for example:
   ```scala
     private def getRandomAliveBroker(image: MetadataImage): 
util.Optional[Integer] = {
       val aliveBrokers = image.cluster().brokers().values().stream()
         .filter(Predicate.not(_.fenced))
         .map(_.id()).toList
       if (aliveBrokers.isEmpty) {
         util.Optional.empty()
       } else {
         
util.Optional.of(aliveBrokers.get(ThreadLocalRandom.current().nextInt(aliveBrokers.size)))
       }
     }
   ```



-- 
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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to