Skip to content

Commit

Permalink
update the demo
Browse files Browse the repository at this point in the history
Signed-off-by: yunfeiyanggzq <[email protected]>
  • Loading branch information
yunfeiyanggzq committed Jul 3, 2020
1 parent f1b6331 commit 6e81558
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
import com.alibaba.csp.sentinel.node.DefaultNode;
import com.alibaba.csp.sentinel.slotchain.AbstractLinkedProcessorSlot;
import com.alibaba.csp.sentinel.slotchain.ResourceWrapper;
import com.alibaba.csp.sentinel.spi.SpiOrder;

/**
* An example slot that records current context and entry resource.
*
* @author Eric Zhao
*/
@SpiOrder(-3500)
public class DemoSlot extends AbstractLinkedProcessorSlot<DefaultNode> {

@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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@
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.
*/
public class DemoSlotChainBuilder implements SlotChainBuilder {

@Override
public ProcessorSlotChain build() {
ProcessorSlotChain chain = new DefaultSlotChainBuilder().build();
chain.addLast(new DemoSlot());
return chain;
}
@Deprecated
public class DemoSlotChainBuilder extends DefaultSlotChainBuilder {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Custom slot processor
com.alibaba.csp.sentinel.demo.slot.DemoSlot

This file was deleted.

0 comments on commit 6e81558

Please sign in to comment.