mdedetrich commented on code in PR #12063: URL: https://github.com/apache/kafka/pull/12063#discussion_r852808807
########## core/src/main/scala/kafka/server/metadata/BrokerMetadataListener.scala: ########## @@ -248,6 +248,24 @@ class BrokerMetadataListener( } } + // This is used in tests to alter the publisher that is in use by the broker. + def alterPublisher(publisher: MetadataPublisher): CompletableFuture[Void] = { + val event = new AlterPublisherEvent(publisher) + eventQueue.append(event) + event.future + } + + class AlterPublisherEvent(publisher: MetadataPublisher) + extends EventQueue.FailureLoggingEvent(log) { + val future = new CompletableFuture[Void]() + + override def run(): Unit = { + _publisher = Some(publisher) + log.info(s"Set publisher to ${publisher}") Review Comment: If this is only used in tests does it make sense to alter `alterPublisher` to give it a second parameter accepting a value that implements `EventQueue.FailureLoggingEvent` and then define the `AlterPublisherEvent` class in `/core/src/test` rather than `core/src/main`. That way its more clear the class is only being used for tests. -- 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