You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/02/03 17:30:35 UTC

[GitHub] [kafka] cmccabe commented on a change in pull request #10028: Replace BrokerStates.scala with BrokerState.java

cmccabe commented on a change in pull request #10028:
URL: https://github.com/apache/kafka/pull/10028#discussion_r569604728



##########
File path: core/src/main/scala/kafka/log/LogManager.scala
##########
@@ -60,7 +61,7 @@ class LogManager(logDirs: Seq[File],
                  val retentionCheckMs: Long,
                  val maxPidExpirationMs: Int,
                  scheduler: Scheduler,
-                 val brokerState: BrokerState,
+                 val brokerState: AtomicReference[BrokerState],

Review comment:
       The log manager needs to alter the broker state using the `AtomicReference`.  Since the broker state is owned by `KafkaBroker`, this would not be possible by just using a volatile variable.
   
   (This is an ugly pattern, I think, and a later patch set removes it.  But in the interest of keeping this PR small, we preserve the original behavior where LogManager changes the broker state directly for now)




----------------------------------------------------------------
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:
users@infra.apache.org