johnnychhsu opened a new pull request, #15550:
URL: https://github.com/apache/kafka/pull/15550
## Context
In KafkaMetirc.java, the config 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
Refer to [KAFKA-16381](https://issues.apache.org/jira/browse/KAFKA-16381).
## Solution
Add the lock in the config getter
## Test
```
./gradlew cleanTest core:test --tests ConnectionQuotasTest --tests
ControllerMutationQuotaTest stream:test --tests StandbyTaskTest --tests
StreamTaskTest
```
and it passed
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]