From 2822de1400b5d893a191803d3515d6694c0ab641 Mon Sep 17 00:00:00 2001 From: yunfeiyanggzq Date: Thu, 2 Jul 2020 17:49:56 +0800 Subject: [PATCH] update the demo Signed-off-by: yunfeiyanggzq --- .../java/com/alibaba/csp/sentinel/demo/slot/DemoSlot.java | 2 +- .../csp/sentinel/demo/slot/DemoSlotChainBuilder.java | 7 ++++--- .../com.alibaba.csp.sentinel.slotchain.ProcessorSlot | 2 ++ .../com.alibaba.csp.sentinel.slotchain.SlotChainBuilder | 2 -- 4 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.ProcessorSlot delete mode 100644 sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder diff --git a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlot.java b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlot.java index ea9f329fd7..d3bcae0a61 100644 --- a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlot.java +++ b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlot.java @@ -29,7 +29,7 @@ public class DemoSlot extends AbstractLinkedProcessorSlot { @Override public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count, boolean prioritized, Object... args) - throws Throwable { + throws Throwable { System.out.println("Current context: " + context.getName()); System.out.println("Current entry resource: " + context.getCurEntry().getResourceWrapper().getName()); diff --git a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlotChainBuilder.java b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlotChainBuilder.java index c311c89daa..63a8707a95 100644 --- a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlotChainBuilder.java +++ b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/java/com/alibaba/csp/sentinel/demo/slot/DemoSlotChainBuilder.java @@ -20,11 +20,12 @@ import com.alibaba.csp.sentinel.slots.DefaultSlotChainBuilder; /** - * An example slot chain builder. To activate this slot chain builder, - * add the class name to corresponding SPI file in `resource/META-INF/services` directory. - * * @author Eric Zhao + * + * @deprecated since 1.7.2, we can use @SpiOrder(-3500) to adjust the order of {@link DemoSlot}, + * this class is reserved for compatibility with older versions. */ +@Deprecated public class DemoSlotChainBuilder implements SlotChainBuilder { @Override diff --git a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.ProcessorSlot b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.ProcessorSlot new file mode 100644 index 0000000000..a14b342218 --- /dev/null +++ b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.ProcessorSlot @@ -0,0 +1,2 @@ +# Custom slot processor slot +com.alibaba.csp.sentinel.demo.slot.DemoSlot \ No newline at end of file diff --git a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder b/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder deleted file mode 100644 index 529b016a1b..0000000000 --- a/sentinel-demo/sentinel-demo-slot-chain-spi/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder +++ /dev/null @@ -1,2 +0,0 @@ -# Custom slot chain builder -com.alibaba.csp.sentinel.demo.slot.DemoSlotChainBuilder \ No newline at end of file