felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1680296 - /felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
Date Tue, 19 May 2015 14:03:22 GMT
Author: cziegeler
Date: Tue May 19 14:03:21 2015
New Revision: 1680296

URL: http://svn.apache.org/r1680296
Log:
FELIX-4888 : ServletHandler's are not sorted by longest matching path. DTO handling (WiP)

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java?rev=1680296&r1=1680295&r2=1680296&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
Tue May 19 14:03:21 2015
@@ -24,6 +24,7 @@ import static org.osgi.service.http.runt
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -747,7 +748,15 @@ public final class WhiteboardManager
     {
         final FailedDTOHolder failedDTOHolder = new FailedDTOHolder();
 
-        final Collection<ServletContextDTO> contextDTOs = new TreeSet<ServletContextDTO>();
+        final Collection<ServletContextDTO> contextDTOs = new TreeSet<ServletContextDTO>(new
Comparator<ServletContextDTO>() {
+
+            @Override
+            public int compare(ServletContextDTO o1, ServletContextDTO o2) {
+                // Service id's can be negative. Negative id's follow the reverse natural
ordering of integers.
+                int reverseOrder = ( o1.serviceId >= 0 && o2.serviceId >= 0
) ? 1 : -1;
+                return reverseOrder * Long.compare(o1.serviceId, o2.serviceId);
+            }
+        });
 
         synchronized ( this.contextMap )
         {



Mime
View raw message