incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1513399 - /sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java
Date Tue, 13 Aug 2013 09:23:37 GMT
Author: bdelacretaz
Date: Tue Aug 13 09:23:36 2013
New Revision: 1513399

URL: http://svn.apache.org/r1513399
Log:
SLING-2987 - HealthCheckFilter sorts ServiceReferences to have a predictable order

Modified:
    sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java

Modified: sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java?rev=1513399&r1=1513398&r2=1513399&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java
(original)
+++ sling/trunk/contrib/extensions/healthcheck/api/src/main/java/org/apache/sling/hc/util/HealthCheckFilter.java
Tue Aug 13 09:23:36 2013
@@ -18,6 +18,8 @@
 package org.apache.sling.hc.util;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.sling.hc.api.Constants;
@@ -39,6 +41,7 @@ public class HealthCheckFilter {
         bundleContext = bc;
     }
     
+    @SuppressWarnings("unchecked")
     public List<HealthCheck> getTaggedHealthCheck(String... tags) {
         
         // Build service filter
@@ -67,7 +70,10 @@ public class HealthCheckFilter {
                 log.info("Found no HealthCheck services with filter [{}]", filterString);
             } else {
                 log.info("Found {} HealthCheck services with filter [{}]", refs.length, filterString);
-                for(ServiceReference ref : refs) {
+                final List<ServiceReference> sortedRefs = Arrays.asList(refs);
+                Collections.sort(sortedRefs);
+                
+                for(ServiceReference ref : sortedRefs) {
                     final HealthCheck hc = (HealthCheck)bundleContext.getService(ref);
                     log.debug("Selected HealthCheck service {}", hc);
                     result.add(hc);



Mime
View raw message