YARN-10152. Fix findbugs warnings in hadoop-yarn-applications-mawo-core module (#1852)
This commit is contained in:
parent
033a3d7ff9
commit
7dfa37e8f0
@ -22,6 +22,7 @@
|
|||||||
import java.io.DataOutput;
|
import java.io.DataOutput;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
import org.apache.hadoop.applications.mawo.server.worker.WorkerId;
|
import org.apache.hadoop.applications.mawo.server.worker.WorkerId;
|
||||||
import org.apache.hadoop.io.Writable;
|
import org.apache.hadoop.io.Writable;
|
||||||
import org.apache.hadoop.io.WritableUtils;
|
import org.apache.hadoop.io.WritableUtils;
|
||||||
@ -344,4 +345,39 @@ public final WorkerId getWorkerId() {
|
|||||||
public final void setWorkerId(final WorkerId localworkerId) {
|
public final void setWorkerId(final WorkerId localworkerId) {
|
||||||
this.workerId = localworkerId;
|
this.workerId = localworkerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null || obj.getClass() != this.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TaskStatus other = (TaskStatus) obj;
|
||||||
|
return (getWorkerId().equals(other.getWorkerId()) &&
|
||||||
|
getTaskId().equals(other.getTaskId()) &&
|
||||||
|
getRunState().equals(other.getRunState()) &&
|
||||||
|
getStartTime() == other.getStartTime() &&
|
||||||
|
getEndTime() == other.getEndTime() &&
|
||||||
|
getTaskCMD().equals(other.getTaskCMD()) &&
|
||||||
|
getTaskType().equals(other.getTaskType()) &&
|
||||||
|
getExitCode() == other.getExitCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
HashCodeBuilder builder = new HashCodeBuilder();
|
||||||
|
builder.append(getWorkerId())
|
||||||
|
.append(getTaskId())
|
||||||
|
.append(getRunState())
|
||||||
|
.append(getStartTime())
|
||||||
|
.append(getEndTime())
|
||||||
|
.append(getTaskCMD())
|
||||||
|
.append(getTaskType())
|
||||||
|
.append(getExitCode());
|
||||||
|
return builder.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object clone() throws CloneNotSupportedException {
|
||||||
|
return super.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ public final String getIPAddress() {
|
|||||||
* Print workerId.
|
* Print workerId.
|
||||||
* @return workeId in string
|
* @return workeId in string
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
return workerId.toString();
|
return workerId.toString();
|
||||||
}
|
}
|
||||||
@ -111,11 +112,15 @@ public final void setWorkerId(final String localworkerId) {
|
|||||||
* Implememt equals method for WorkerId.
|
* Implememt equals method for WorkerId.
|
||||||
*/
|
*/
|
||||||
public final boolean equals(final Object o) {
|
public final boolean equals(final Object o) {
|
||||||
|
if (o == null || this.getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
WorkerId x = (WorkerId) o;
|
WorkerId x = (WorkerId) o;
|
||||||
return x.getHostname().equals(this.hostname);
|
return x.getHostname().equals(this.hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
public final void write(final DataOutput dataOutput) throws IOException {
|
public final void write(final DataOutput dataOutput) throws IOException {
|
||||||
workerId.write(dataOutput);
|
workerId.write(dataOutput);
|
||||||
hostname.write(dataOutput);
|
hostname.write(dataOutput);
|
||||||
@ -123,6 +128,7 @@ public final void write(final DataOutput dataOutput) throws IOException {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
public final void readFields(final DataInput dataInput) throws IOException {
|
public final void readFields(final DataInput dataInput) throws IOException {
|
||||||
workerId.readFields(dataInput);
|
workerId.readFields(dataInput);
|
||||||
hostname.readFields(dataInput);
|
hostname.readFields(dataInput);
|
||||||
|
Loading…
Reference in New Issue
Block a user