bbeaudreault commented on code in PR #5072:
URL: https://github.com/apache/hbase/pull/5072#discussion_r1125511381
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServer.java:
##########
@@ -122,89 +101,79 @@ public MetricsRegionServerWrapper
getRegionServerWrapper() {
return regionServerWrapper;
}
- public void updatePutBatch(TableName tn, long t) {
- if (tableMetrics != null && tn != null) {
- tableMetrics.updatePutBatch(tn, t);
- }
+ public void updatePutBatch(HRegion region, long t) {
+ Optional.ofNullable(region).ifPresent(r ->
Optional.ofNullable(r.getMetricsTableRequests())
Review Comment:
Oh, I thought you were going to remove all the Optional stuff.
If you want to keep that, I think we should just have
region.getTableMetrics() return an Optional. That way we don't have to create 2
optionals in every call. You can an just chain them together with flatMap.
--
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]