YARN-8830. SLS tool fix node addition. Contributed by Bibin A Chundatt.

This commit is contained in:
bibinchundatt 2018-10-15 16:10:25 +05:30
parent b60ca37914
commit b4a38e7b3e

View File

@ -45,6 +45,8 @@
import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.Options; import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException; import org.apache.commons.cli.ParseException;
import org.apache.commons.collections.SetUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
@ -1029,5 +1031,32 @@ public Set<NodeLabel> getLabels() {
public void setLabels(Set<NodeLabel> labels) { public void setLabels(Set<NodeLabel> labels) {
this.labels = labels; this.labels = labels;
} }
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof NodeDetails)) {
return false;
}
NodeDetails that = (NodeDetails) o;
return StringUtils.equals(hostname, that.hostname) && (
nodeResource == null ?
that.nodeResource == null :
nodeResource.equals(that.nodeResource)) && SetUtils
.isEqualSet(labels, that.labels);
}
@Override
public int hashCode() {
int result = hostname == null ? 0 : hostname.hashCode();
result =
31 * result + (nodeResource == null ? 0 : nodeResource.hashCode());
result = 31 * result + (labels == null ? 0 : labels.hashCode());
return result;
}
} }
} }