You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2024/03/23 03:39:00 UTC

[jira] [Resolved] (KAFKA-16381) use volatile to guarantee KafkaMetric#config visibility across threads

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

Chia-Ping Tsai resolved KAFKA-16381.
------------------------------------
    Fix Version/s: 3.8.0
       Resolution: Fixed

> use volatile to guarantee KafkaMetric#config visibility across threads
> ----------------------------------------------------------------------
>
>                 Key: KAFKA-16381
>                 URL: https://issues.apache.org/jira/browse/KAFKA-16381
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Johnny Hsu
>            Assignee: Johnny Hsu
>            Priority: Minor
>             Fix For: 3.8.0
>
>
> In KafkaMetirc.java, the getter is 
> ```
> @Override
> public MetricName metricName() {
> return this.metricName;
> }
> ```
> and there is a setter 
> ```
> public void config(MetricConfig config) {
>     synchronized (lock) {
>     this.config = config;
>   }
> }
> ```
> Since it's possible to set and get in the mean time, we should have lock in the getter as well



--
This message was sent by Atlassian Jira
(v8.20.10#820010)