You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Grant Henke (JIRA)" <ji...@apache.org> on 2015/03/24 17:37:53 UTC

[jira] [Assigned] (KAFKA-1991) Clean ControllerStats initialization

     [ https://issues.apache.org/jira/browse/KAFKA-1991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Henke reassigned KAFKA-1991:
----------------------------------

    Assignee: Grant Henke

> 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
>            Assignee: Grant Henke
>            Priority: Trivial
>         Attachments: KAFKA-1991.patch
>
>
> 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)