Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

*bug report* ProcessorSlot的Spi中的isSingleton = false设置不生效

Open HuLaLaGa opened this issue 2 years ago • 3 comments

Issue Description

Type: bug report

Describe what happened (or what feature you want)

当在非单例模式的ProcessorSlot(A)前加一个单例模式的ProcessorSlot(B)后,所有ProcessorSlotChain中B的next都会同步修改为最新创建的A

Describe what you expected to happen

在上述行为后,不同的ProcessorSlotChain中B的next应该为各自新创建的A,而非共同的A

How to reproduce it (as minimally and precisely as possible)

  1. 添加一个ProcessSlot实现类,添加注解@Spi(order = Spi.ORDER_HIGHEST)

Tell us your environment

sentinel 1.8.3

Anything else we need to know?

DefaultProcessorSlotChain中添加next的方式是直接修改传入的AbstractLinkedProcessorSlot,但是传入的ProcessorSlot有可能是单例或非单例,倘若是单例,则在其后添加next会影响所有的ProcessorSlotChain

HuLaLaGa avatar Dec 29 '22 01:12 HuLaLaGa

cc @cdfive

sczyh30 avatar Dec 29 '22 01:12 sczyh30

能否使用两个ProcessorSlot没有直接联系的方式,但只有顺序的方式实现。例如数组

githubcheng2978 avatar Jan 09 '23 07:01 githubcheng2978

如果要实现的话,感觉必须抛弃传统的链式调用, 单例对象持有的next对象一定也是唯一的. 数组是一个不错的实现方式,上下节点之间不存在明显的引用关系

LiYangSir avatar Feb 23 '23 07:02 LiYangSir