[ https://issues.apache.org/jira/browse/FELIX-6607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724147#comment-17724147 ]
Christoph Läubrich commented on FELIX-6607: ------------------------------------------- As said you can simply assume a rank of 0 if the service reference is zero. The default OSGi implementation uses the serviceid if two ranks are the same, so if you encounter this case just assume that internal plugins have a service id of INTEGER.MAX. So the code in compare might look like this: {code:java} final int thisRanking = registration==null? 0: registration.getRanking(); final int otherRanking = other.registration==null? 0 : other.registration.getRanking(); if (thisRanking != otherRanking) { if (thisRanking < otherRanking) { return -1; } return 1; } final long thisId = registration == null? Integer.MAX_INT : registration.getId(); final long otherId = other.registration ==null? Integer.MAX_INT: other.registration.getId(); if (thisId == otherId) { return 0; } if (thisId < otherId) { return 1; } return -1; {code} > Web Console Plugins should have a predictable order in case of label conflicts > ------------------------------------------------------------------------------ > > Key: FELIX-6607 > URL: https://issues.apache.org/jira/browse/FELIX-6607 > Project: Felix > Issue Type: Improvement > Components: Web Console > Reporter: Konrad Windszus > Priority: Major > > In case two web console plugins register for the same label it is currently > not predictable which is getting used (because the service being started > later overwrites earlier ones with the same label). The regular > ServiceReference.compareTo(…) semantics should be used to determine which of > the conflicting plugins should win. > Internal plugins which do not rely on OSGi services (and therefore don't have > a servicereference) should have the highest priority (i.e. should not be > allowed to be overwritten). -- This message was sent by Atlassian Jira (v8.20.10#820010)