diff --git a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala index 4fbb28e..0c9d436 100644 --- a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala +++ b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala @@ -248,10 +248,10 @@ class ReplicaStateMachine(controller: KafkaController) extends Logging { class BrokerChangeListener() extends IZkChildListener with Logging { this.logIdent = "[BrokerChangeListener on Controller " + controller.config.brokerId + "]: " def handleChildChange(parentPath : String, currentBrokerList : java.util.List[String]) { - ControllerStats.leaderElectionTimer.time { - info("Broker change listener fired for path %s with children %s".format(parentPath, currentBrokerList.mkString(","))) - controllerContext.controllerLock synchronized { - if (hasStarted.get) { + info("Broker change listener fired for path %s with children %s".format(parentPath, currentBrokerList.mkString(","))) + controllerContext.controllerLock synchronized { + if (hasStarted.get) { + ControllerStats.leaderElectionTimer.time { try { val curBrokerIds = currentBrokerList.map(_.toInt).toSet val newBrokerIds = curBrokerIds -- controllerContext.liveOrShuttingDownBrokerIds