hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: YARN-7023. Incorrect ReservationId.compareTo() implementation.
Date Fri, 01 Sep 2017 19:36:21 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 57b5b186c -> b616462ee


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

This closes #262

Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
(cherry picked from commit c5281a85e108c7cab6e84dfe351843483d720b9b)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b616462e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b616462e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b616462e

Branch: refs/heads/branch-2
Commit: b616462eef5ee06a0d7f7d5f78b34a8069b80507
Parents: 57b5b18
Author: Oleg Danilov <oleg@olegd.com>
Authored: Wed Aug 16 15:19:26 2017 +0300
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Fri Sep 1 21:36:12 2017 +0200

----------------------------------------------------------------------
 .../apache/hadoop/yarn/api/records/ReservationId.java    | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b616462e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
index a0c209d..fd01115 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
@@ -31,7 +31,7 @@ import org.apache.hadoop.yarn.util.Records;
  * {@link ReservationId} represents the <em>globally unique</em> identifier for
  * a reservation.
  * </p>
- * 
+ *
  * <p>
  * The globally unique nature of the identifier is achieved by using the
  * <em>cluster timestamp</em> i.e. start-time of the {@code ResourceManager}
@@ -62,7 +62,7 @@ public abstract class ReservationId implements Comparable<ReservationId>
{
    * Get the long identifier of the {@link ReservationId} which is unique for
    * all Reservations started by a particular instance of the
    * {@code ResourceManager}.
-   * 
+   *
    * @return long identifier of the {@link ReservationId}
    */
   @Public
@@ -76,7 +76,7 @@ public abstract class ReservationId implements Comparable<ReservationId>
{
   /**
    * Get the <em>start time</em> of the {@code ResourceManager} which is used
to
    * generate globally unique {@link ReservationId}.
-   * 
+   *
    * @return <em>start time</em> of the {@code ResourceManager}
    */
   @Public
@@ -94,10 +94,9 @@ public abstract class ReservationId implements Comparable<ReservationId>
{
   @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());
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message