You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2014/12/03 21:27:30 UTC
[4/8] incubator-usergrid git commit: Changed comparator to be more
concise
Changed comparator to be more concise
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/08471c9e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/08471c9e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/08471c9e
Branch: refs/heads/index-alias
Commit: 08471c9e0f2268603423b9acdd19529190985352
Parents: c2bc921
Author: Todd Nine <tn...@apigee.com>
Authored: Wed Dec 3 09:16:18 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Wed Dec 3 09:16:18 2014 -0700
----------------------------------------------------------------------
stack/awscluster/src/main/groovy/NodeRegistry.groovy | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/08471c9e/stack/awscluster/src/main/groovy/NodeRegistry.groovy
----------------------------------------------------------------------
diff --git a/stack/awscluster/src/main/groovy/NodeRegistry.groovy b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
index 0288ae4..8d695e2 100644
--- a/stack/awscluster/src/main/groovy/NodeRegistry.groovy
+++ b/stack/awscluster/src/main/groovy/NodeRegistry.groovy
@@ -109,7 +109,6 @@ class NodeRegistry {
for (reservation in nodes.getReservations()) {
- //TODO, add these to a list then sort them by date, then name
for (instance in reservation.getInstances()) {
servers.add(new ServerEntry(instance.launchTime, instance.publicDnsName));
}
@@ -169,15 +168,14 @@ class NodeRegistry {
@Override
int compareTo(final ServerEntry o) {
- if (launchDate.before(o.launchDate)) {
- -1;
- } else if (launchDate.after(o.launchDate)) {
- return 1;
- }
- return publicIp.compareTo(o.publicIp);
+ int compare = launchDate.compareTo(o.launchDate)
+ if(compare == 0){
+ compare = publicIp.compareTo(o.publicIp);
+ }
+ return compare
}
boolean equals(final o) {