为什么会有这种方法:SpiLoader#loadFirstInstance?这是不给提供扩展的呀?
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
为什么会有SpiLoader#loadFirstInstance() 这种方法,加载第一个,这第一个是哪一个没得确定的结果 的吧?
它是不是应该跟每个jar 包的加载顺序有关啊。
如果有多个,那每个jar 包的依赖顺序 不同,那最终的结果也是不确定的吧?
这个我没有看源码,所以不确定。但是为什么会有这样的方法存在就很奇怪,在我的认知里它就不应该出现在框架里面才对。
至少也应该是有优先级的(SpiLoader#loadHighestPriorityInstance() 或者 SpiLoader#loadLowestPriorityInstance())。
我现在遇到个问题就是:在com.alibaba.csp.sentinel.cluster.client.TokenClientProvider#resolveTokenClientInstance() 这个方法中就是这样调用的,我现在连扩展的机会都没有,唯一的方法就只有把源代码全改。
有人能解释下吗?为什么会用这个方法的,使用它的场景是什么?
Type: *bug report* or *feature request*
### Describe what happened (or what feature you want)
### Describe what you expected to happen
### How to reproduce it (as minimally and precisely as possible)
1.
2.
3.
### Tell us your environment
### Anything else we need to know?
Contributor guide
Research direction
Start by reading the implementation and callers of SpiLoader#loadFirstInstance, especially com.alibaba.csp.sentinel.cluster.client.TokenClientProvider#resolveTokenClientInstance, then inspect how provider ordering is determined across JARs. Clarify the intended extension and priority semantics with maintainers; done would require an agreed behavior and corresponding tests or documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100