From c5281a85e108c7cab6e84dfe351843483d720b9b Mon Sep 17 00:00:00 2001
From: Oleg Danilov
* The globally unique nature of the identifier is achieved by using the * cluster timestamp i.e. start-time of the {@code ResourceManager} @@ -62,7 +62,7 @@ public static ReservationId newInstance(long clusterTimestamp, long id) { * 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 static ReservationId newInstance(long clusterTimestamp, long id) { /** * Get the start time of the {@code ResourceManager} which is used to * generate globally unique {@link ReservationId}. - * + * * @return start time of the {@code ResourceManager} */ @Public @@ -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()); } }