sanjeet006py commented on code in PR #6868: URL: https://github.com/apache/hbase/pull/6868#discussion_r2096348055
########## hbase-client/src/main/java/org/apache/hadoop/hbase/client/metrics/ScanMetricsRegionInfo.java: ########## @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.client.metrics; + +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * POJO for capturing region level details when region level scan metrics are enabled. <br> + * <br> + * Currently, encoded region name and server name (host name, ports and startcode) are captured as + * region details. <br> + * <br> + * Instance of this class serves as key in the Map returned by + * {@link ServerSideScanMetrics#getMetricsMapByRegion()} or + * {@link ServerSideScanMetrics#getMetricsMapByRegion(boolean)}. + */ [email protected] +public class ScanMetricsRegionInfo { + /** + * Users should only compare against this constant by reference and should not make any + * assumptions regarding content of the constant. + */ + public static final ScanMetricsRegionInfo EMPTY_SCAN_METRICS_REGION_INFO = + new ScanMetricsRegionInfo(null, null); + + private final Pair<String, ServerName> regionAndServerName; + + ScanMetricsRegionInfo(String encodedRegionName, ServerName serverName) { + this.regionAndServerName = new Pair<>(encodedRegionName, serverName); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ScanMetricsRegionInfo)) { + return false; + } + return regionAndServerName.equals(((ScanMetricsRegionInfo) obj).regionAndServerName); + } + + @Override + public int hashCode() { + return regionAndServerName.hashCode(); + } + + @Override + public String toString() { + return regionAndServerName.toString(); Review Comment: Sorry, I did't get this. Can you please elaborate. -- 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]
