vli02 commented on code in PR #4874:
URL: https://github.com/apache/hbase/pull/4874#discussion_r1020627589


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java:
##########
@@ -54,6 +58,38 @@
 @InterfaceAudience.Private
 public class MetricsConnection implements StatisticTrackable {
 
+  static final Map<String, MetricsConnection> METRICS_INSTANCES =
+    new HashMap<String, MetricsConnection>();
+
+  static MetricsConnection getMetricsConnection(final AsyncConnection conn,
+    Supplier<ThreadPoolExecutor> batchPool, Supplier<ThreadPoolExecutor> 
metaPool) {
+    String scope = getScope(conn);
+    MetricsConnection metrics;
+    synchronized (METRICS_INSTANCES) {

Review Comment:
   I am not sure if a synchronized or concurrent map can protect the entire 
block, I want this entire block to run in single thread mode. Especially in the 
deletion method below, the decrementing count, getting count, and remove it 
from the map have to be single threaded. @apurtell @d-c-manning 



-- 
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]

Reply via email to