Which SlotChainBuilder is used is unpredictable, depends on order of resource loading #1128
Labels
kind/discussion
For further discussion
kind/enhancement
Category issues or prs related to enhancement.
Issue Description
Which com.alibaba.csp.sentinel.slotchain.SlotChainBuilder to use can be specified by creating a resource file resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder.
However, sentinel-core already ships its own file that uses com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder.
If an user provides his own resource file, we have multiple files (resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder) in classpath. Which one actually gets used depends on which resource file is loaded first, which is unpredictable and may cause unexpected issues.
Type: bug report or feature request
bug report
Describe what happened (or what feature you want)
If a user provides a resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder, it may not get used because sentinel-core already ships one.
Describe what you expected to happen
Which SlotChainBuilder is used can be specified in a predictable way, maybe a system property.
If there are multiple specifications, raise an error with detailed message on how to specify which one to use.
How to reproduce it (as minimally and precisely as possible)
Tell us your environment
Anything else we need to know?
From Alibaba with love
The text was updated successfully, but these errors were encountered: