Skip to content

Commit

Permalink
KAFKA-18432: Remove Option wrapper from channelManager parameter
Browse files Browse the repository at this point in the history
The `channelManager` parameter is now required and no longer optional.
  • Loading branch information
LoganZhuZzz committed Jan 8, 2025
1 parent f530cd0 commit f8ffab5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,11 @@ trait AutoTopicCreationManager {

class DefaultAutoTopicCreationManager(
config: KafkaConfig,
channelManager: Option[NodeToControllerChannelManager],
channelManager: NodeToControllerChannelManager,
groupCoordinator: GroupCoordinator,
txnCoordinator: TransactionCoordinator,
shareCoordinator: Option[ShareCoordinator]
) extends AutoTopicCreationManager with Logging {
if (channelManager.isEmpty) {
throw new IllegalArgumentException("Must supply a channel manager for auto topic creation")
}

private val inflightTopics = Collections.newSetFromMap(new ConcurrentHashMap[String, java.lang.Boolean]())

Expand Down Expand Up @@ -117,10 +114,6 @@ class DefaultAutoTopicCreationManager(
}
}

val channelManager = this.channelManager.getOrElse {
throw new IllegalStateException("Channel manager must be defined in order to send CreateTopic requests.")
}

val request = metadataRequestContext.map { context =>
val requestVersion =
channelManager.controllerApiVersions.toScala match {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/kafka/server/BrokerServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class BrokerServer(
producerIdManagerSupplier, metrics, metadataCache, Time.SYSTEM)

autoTopicCreationManager = new DefaultAutoTopicCreationManager(
config, Some(clientToControllerChannelManager), groupCoordinator,
config, clientToControllerChannelManager, groupCoordinator,
transactionCoordinator, shareCoordinator)

dynamicConfigHandlers = Map[String, ConfigHandler](
Expand Down

0 comments on commit f8ffab5

Please sign in to comment.