use of com.alibaba.csp.sentinel.slotchain.DefaultProcessorSlotChain in project Sentinel by alibaba.
the class DefaultSlotChainBuilder method build.
@Override
public ProcessorSlotChain build() {
ProcessorSlotChain chain = new DefaultProcessorSlotChain();
List<ProcessorSlot> sortedSlotList = SpiLoader.of(ProcessorSlot.class).loadInstanceListSorted();
for (ProcessorSlot slot : sortedSlotList) {
if (!(slot instanceof AbstractLinkedProcessorSlot)) {
RecordLog.warn("The ProcessorSlot(" + slot.getClass().getCanonicalName() + ") is not an instance of AbstractLinkedProcessorSlot, can't be added into ProcessorSlotChain");
continue;
}
chain.addLast((AbstractLinkedProcessorSlot<?>) slot);
}
return chain;
}
use of com.alibaba.csp.sentinel.slotchain.DefaultProcessorSlotChain in project Sentinel by alibaba.
the class CtSphTest method addShouldNotPassSlotFor.
private void addShouldNotPassSlotFor(ResourceWrapper resourceWrapper) {
ProcessorSlotChain slotChain = new DefaultProcessorSlotChain();
slotChain.addLast(new ShouldNotPassSlot());
CtSph.getChainMap().put(resourceWrapper, slotChain);
}
use of com.alibaba.csp.sentinel.slotchain.DefaultProcessorSlotChain in project Sentinel by alibaba.
the class CtSphTest method addMustBlockSlot.
private MustBlockSlot addMustBlockSlot(ResourceWrapper resourceWrapper) {
ProcessorSlotChain slotChain = new DefaultProcessorSlotChain();
MustBlockSlot mustBlockSlot = new MustBlockSlot();
slotChain.addLast(mustBlockSlot);
CtSph.getChainMap().put(resourceWrapper, slotChain);
return mustBlockSlot;
}
use of com.alibaba.csp.sentinel.slotchain.DefaultProcessorSlotChain in project Sentinel by alibaba.
the class CtSphTest method addShouldPassSlotFor.
private ShouldPassSlot addShouldPassSlotFor(ResourceWrapper resourceWrapper) {
ProcessorSlotChain slotChain = new DefaultProcessorSlotChain();
ShouldPassSlot shouldPassSlot = new ShouldPassSlot();
slotChain.addLast(shouldPassSlot);
CtSph.getChainMap().put(resourceWrapper, slotChain);
return shouldPassSlot;
}
Aggregations