goiri commented on code in PR #5096:
URL: https://github.com/apache/hadoop/pull/5096#discussion_r1012244149


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/ReservationHomeSubCluster.java:
##########
@@ -94,20 +94,20 @@ public static ReservationHomeSubCluster 
newInstance(ReservationId resId,
 
   @Override
   public boolean equals(Object obj) {
+
     if (this == obj) {
       return true;
     }
-    if (obj == null) {
-      return false;
-    }
-    if (getClass() != obj.getClass()) {
+
+    if (obj == null || getClass() != obj.getClass()) {
       return false;
     }
-    ReservationHomeSubCluster other = (ReservationHomeSubCluster) obj;
+
+    ReservationHomeSubCluster right = (ReservationHomeSubCluster) obj;
 
     return new EqualsBuilder()
-        .append(this.getReservationId(), other.getReservationId())
-        .append(this.getHomeSubCluster(), other.getHomeSubCluster())
+        .append(this.getReservationId(), right.getReservationId())

Review Comment:
   The other terminology was good I'd say.



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/ApplicationHomeSubCluster.java:
##########
@@ -123,32 +125,35 @@ public static ApplicationHomeSubCluster 
newInstance(ApplicationId appId, long cr
 
   @Override
   public boolean equals(Object obj) {
+
     if (this == obj) {
       return true;
     }
-    if (obj == null) {
-      return false;
-    }
-    if (getClass() != obj.getClass()) {
-      return false;
-    }
-    ApplicationHomeSubCluster other = (ApplicationHomeSubCluster) obj;
-    if (!this.getApplicationId().equals(other.getApplicationId())) {
+
+    if (obj == null || getClass() != obj.getClass()) {

Review Comment:
   Most other classes use instanceof



##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/store/records/RouterMasterKey.java:
##########
@@ -130,4 +130,10 @@ public boolean equals(Object right) {
         .append(getKeyBytes().array(), r.getKeyBytes())
         .isEquals();
   }
+
+  @Override
+  public String toString() {
+    return "RouterMasterKey [keyId = " + getKeyId()

Review Comment:
   StringBuilder might be better for this.



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