[
https://issues.apache.org/jira/browse/KAFKA-16381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chia-Ping Tsai updated KAFKA-16381:
-----------------------------------
Summary: use volatile to guarantee KafkaMetric#config visibility across
threads (was: We should use a lock to protect the config getter in KafkaMetric)
> 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
>
> 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)