Grant Henke created KAFKA-1991: ---------------------------------- Summary: Clean ControllerStats initialization Key: KAFKA-1991 URL: https://issues.apache.org/jira/browse/KAFKA-1991 Project: Kafka Issue Type: Improvement Components: core Affects Versions: 0.8.2.0 Reporter: Grant Henke Priority: Trivial
This is just a trivial clean up. Values defined by an object are instantiated lazily and are initialized the first time the object is used. This could cause confusion and down the road issues about when/what metrics are initialized in the ControllerStats object. KafkaServer.scala makes a call to each value to initialize it but Scala is not actually behaving that way. The change matches the BrokerTopicStats implementation example: scala> object ControllerStats { | val uncleanLeaderElectionRate = { | println("initializing uncleanLeaderElectionRate") | "uncleanLeaderElectionRate" | } | val leaderElectionTimer = { | println("initializing leaderElectionTimer") | "leaderElectionTimer" | } | } defined object ControllerStats scala> ControllerStats.uncleanLeaderElectionRate initializing uncleanLeaderElectionRate initializing leaderElectionTimer res7: String = uncleanLeaderElectionRate -- This message was sent by Atlassian JIRA (v6.3.4#6332)