hachikuji commented on a change in pull request #10252:
URL: https://github.com/apache/kafka/pull/10252#discussion_r588524835



##########
File path: 
core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala
##########
@@ -142,28 +145,19 @@ class BrokerMetadataListener(brokerId: Int,
       case e: Exception => throw new RuntimeException("Unknown metadata record 
type " +
       s"${record.apiKey()} in batch ending at offset ${lastOffset}.")
     }
-    recordType match {
-      case REGISTER_BROKER_RECORD => handleRegisterBrokerRecord(imageBuilder,
-        record.asInstanceOf[RegisterBrokerRecord])
-      case UNREGISTER_BROKER_RECORD => 
handleUnregisterBrokerRecord(imageBuilder,
-        record.asInstanceOf[UnregisterBrokerRecord])
-      case TOPIC_RECORD => handleTopicRecord(imageBuilder,
-        record.asInstanceOf[TopicRecord])
-      case PARTITION_RECORD => handlePartitionRecord(imageBuilder,
-        record.asInstanceOf[PartitionRecord])
-      case CONFIG_RECORD => 
handleConfigRecord(record.asInstanceOf[ConfigRecord])
-      case PARTITION_CHANGE_RECORD => handlePartitionChangeRecord(imageBuilder,
-        record.asInstanceOf[PartitionChangeRecord])
-      case FENCE_BROKER_RECORD => handleFenceBrokerRecord(imageBuilder,
-        record.asInstanceOf[FenceBrokerRecord])
-      case UNFENCE_BROKER_RECORD => handleUnfenceBrokerRecord(imageBuilder,
-        record.asInstanceOf[UnfenceBrokerRecord])
-      case REMOVE_TOPIC_RECORD => handleRemoveTopicRecord(imageBuilder,
-        record.asInstanceOf[RemoveTopicRecord])
-      case QUOTA_RECORD => handleQuotaRecord(imageBuilder,
-        record.asInstanceOf[QuotaRecord])
-      // TODO: handle FEATURE_LEVEL_RECORD
-      case _ => throw new RuntimeException(s"Unsupported record type 
${recordType}")
+
+    record match {
+      case rec: RegisterBrokerRecord => 
handleRegisterBrokerRecord(imageBuilder, rec)
+      case rec: UnregisterBrokerRecord => 
handleUnregisterBrokerRecord(imageBuilder, rec)
+      case rec: FenceBrokerRecord => handleFenceBrokerRecord(imageBuilder, rec)
+      case rec: UnfenceBrokerRecord => handleUnfenceBrokerRecord(imageBuilder, 
rec)
+      case rec: TopicRecord => handleTopicRecord(imageBuilder, rec)
+      case rec: PartitionRecord => handlePartitionRecord(imageBuilder, rec)

Review comment:
       FYI: https://issues.apache.org/jira/browse/KAFKA-12433




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


Reply via email to