shahrs87 commented on code in PR #5081:
URL: https://github.com/apache/hbase/pull/5081#discussion_r1129905767


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java:
##########
@@ -1125,10 +1130,21 @@ rpcControllerFactory, getMetaLookupPool(), 
connectionConfig.getMetaReadRpcTimeou
 
   void takeUserRegionLock() throws IOException {
     try {
+      long waitStartTime = 0;
       long waitTime = connectionConfig.getMetaOperationTimeout();
+      if (metrics != null) {

Review Comment:
   Whenever we want to update the metrics, we always have to do a null check 
and it makes code too verbose.
   We assign metrics to null if CLIENT_SIDE_METRICS_ENABLED_KEY is set to 
false. Code 
[here](https://github.com/apache/hbase/blob/branch-2/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionImplementation.java#L341)
   Instead of assigning to null, can we assign to some DUMMY_METRICS or 
EMPTY_METRICS and void all the methods. While populating the metrics, check 
whether metrics is an instance of DUMMY_METRICS. If yes then do nothing. This 
will make code look lot cleaner. WDYT? @vli02  @d-c-manning @apurtell 



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