HBASE-27758 Inconsistent synchronization in MetricsUserSourceImpl (#5149)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Bryan Beaudreault 2023-03-31 08:10:58 -04:00 committed by Bryan Beaudreault
parent 9f4b31e619
commit cc00b8b8a8
1 changed files with 16 additions and 20 deletions

View File

@ -137,7 +137,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
@Override
public void register() {
synchronized (this) {
getHisto = registry.newTimeHistogram(userGetKey);
scanTimeHisto = registry.newTimeHistogram(userScanTimeKey);
putHisto = registry.newTimeHistogram(userPutKey);
@ -147,7 +146,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
replayHisto = registry.newTimeHistogram(userReplayKey);
blockBytesScannedCount = registry.newCounter(userBlockBytesScannedKey, "", 0);
}
}
@Override
public void deregister() {
@ -162,7 +160,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
LOG.debug("Removing user Metrics for user: " + user);
}
synchronized (this) {
registry.removeMetric(userGetKey);
registry.removeMetric(userScanTimeKey);
registry.removeMetric(userPutKey);
@ -172,7 +169,6 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
registry.removeMetric(userReplayKey);
registry.removeMetric(userBlockBytesScannedKey);
}
}
@Override
public String getUser() {