[ https://issues.apache.org/jira/browse/SCB-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633389#comment-16633389 ]
ASF GitHub Bot commented on SCB-942: ------------------------------------ laijianbin closed pull request #934: [SCB-942]Choose the highest priority from all impelementation classes URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/934 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java index ea8a0bc12..b8b74adcb 100644 --- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java +++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/SPIServiceUtils.java @@ -149,7 +149,7 @@ private SPIServiceUtils() { List<T> services = getOrLoadSortedService(serviceType); return (IMPL) services .stream() - .filter(service -> service.getClass().equals(implType)) + .filter(service -> implType.isAssignableFrom(service.getClass())) .findFirst() .orElse(null); } diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestSPIServiceUtils.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestSPIServiceUtils.java index 6b26ff9e8..fd22cebe3 100644 --- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestSPIServiceUtils.java +++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestSPIServiceUtils.java @@ -154,4 +154,10 @@ public void getPriorityHighestServices() { Map<Class<?>, List<Object>> cache = Deencapsulation.getField(SPIServiceUtils.class, "cache"); cache.clear(); } + + + @Test + public void testGetTargetService() { + Assert.assertEquals(-1, SPIServiceUtils.getTargetService(TestPriority.class, TestSubPriotiryImpl.class).getOrder()); + } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > choose the highest priority from all implementation classes > ----------------------------------------------------------- > > Key: SCB-942 > URL: https://issues.apache.org/jira/browse/SCB-942 > Project: Apache ServiceComb > Issue Type: Task > Reporter: laijianbin > Assignee: laijianbin > Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)