YARN-7023. Incorrect ReservationId.compareTo() implementation.

This closes #262

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
Oleg Danilov 2017-08-16 15:19:26 +03:00 committed by Akira Ajisaka
parent 0d419c984f
commit c5281a85e1
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -94,10 +94,9 @@ public static ReservationId newInstance(long clusterTimestamp, long id) {
@Override
public int compareTo(ReservationId other) {
if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) {
return getId() > getId() ? 1 : getId() < getId() ? -1 : 0;
return Long.compare(getId(), other.getId());
} else {
return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1
: this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0;
return Long.compare(getClusterTimestamp(), other.getClusterTimestamp());
}
}