complone commented on code in PR #7306:
URL: https://github.com/apache/hudi/pull/7306#discussion_r1057250527
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/metrics/HoodieLockMetrics.java:
##########
@@ -70,11 +71,13 @@ private String getMetricsName(String metric) {
private Timer createTimerForMetrics(MetricRegistry registry, String metric) {
String metricName = getMetricsName(metric);
- synchronized (REGISTRY_LOCK) {
- if (registry.getMetrics().get(metricName) == null) {
- lockDuration = new Timer(new SlidingWindowReservoir(keepLastNtimes));
- registry.register(metricName, lockDuration);
- return lockDuration;
+ if (registry.getMetrics().get(metricName) == null) {
+ synchronized (Registry.class) {
+ if (registry.getMetrics().get(metricName) == null) {
Review Comment:
Yes, it is not necessary to lock the whole class. I will make the correction
in these two days
--
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]