Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-16381

use volatile to guarantee KafkaMetric#config visibility across threads

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.8.0
    • None
    • None

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              johnnyhsu Johnny Hsu
              johnnyhsu Johnny Hsu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: