usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [4/8] incubator-usergrid git commit: Changed comparator to be more concise
Date Wed, 03 Dec 2014 20:27:30 GMT
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 <tnine@apigee.com>
Authored: Wed Dec 3 09:16:18 2014 -0700
Committer: Todd Nine <tnine@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) {


Mime
View raw message