slfan1989 commented on code in PR #5193:
URL: https://github.com/apache/hadoop/pull/5193#discussion_r1049116024


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RefreshSuperUserGroupsConfigurationRequestPBImpl.java:
##########
@@ -56,16 +60,45 @@ public int hashCode() {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null)
+    if (other == null) {
       return false;
-    if (other.getClass().isAssignableFrom(this.getClass())) {
-      return this.getProto().equals(this.getClass().cast(other).getProto());
     }
-    return false;
+
+    if (!(other instanceof RefreshSuperUserGroupsConfigurationRequest)) {

Review Comment:
   Thanks for your suggestion, I will modify the code.



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RefreshSuperUserGroupsConfigurationRequestPBImpl.java:
##########
@@ -56,16 +60,45 @@ public int hashCode() {
 
   @Override
   public boolean equals(Object other) {
-    if (other == null)
+    if (other == null) {
       return false;
-    if (other.getClass().isAssignableFrom(this.getClass())) {
-      return this.getProto().equals(this.getClass().cast(other).getProto());
     }
-    return false;
+
+    if (!(other instanceof RefreshSuperUserGroupsConfigurationRequest)) {
+      return false;
+    }
+
+    RefreshSuperUserGroupsConfigurationRequestPBImpl otherImpl = 
this.getClass().cast(other);
+    return new EqualsBuilder()
+        .append(this.getProto(), otherImpl.getProto())
+        .isEquals();
   }
 
   @Override
   public String toString() {
     return TextFormat.shortDebugString(getProto());
   }
+
+  private synchronized void maybeInitBuilder() {
+    if (viaProto || builder == null) {
+      builder = 
RefreshSuperUserGroupsConfigurationRequestProto.newBuilder(proto);
+    }
+    viaProto = false;
+  }
+
+  @Override
+  public String getSubClusterId() {
+    RefreshSuperUserGroupsConfigurationRequestProtoOrBuilder p = viaProto ? 
proto : builder;
+    return (p.hasSubClusterId()) ? p.getSubClusterId() : null;

Review Comment:
   I will modify the code.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to