|
@@ -19,17 +19,19 @@ import com.alibaba.csp.sentinel.context.Context; |
|
|
import com.alibaba.csp.sentinel.node.DefaultNode; |
|
|
import com.alibaba.csp.sentinel.node.DefaultNode; |
|
|
import com.alibaba.csp.sentinel.slotchain.AbstractLinkedProcessorSlot; |
|
|
import com.alibaba.csp.sentinel.slotchain.AbstractLinkedProcessorSlot; |
|
|
import com.alibaba.csp.sentinel.slotchain.ResourceWrapper; |
|
|
import com.alibaba.csp.sentinel.slotchain.ResourceWrapper; |
|
|
|
|
|
import com.alibaba.csp.sentinel.spi.SpiOrder; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* An example slot that records current context and entry resource. |
|
|
* An example slot that records current context and entry resource. |
|
|
* |
|
|
* |
|
|
* @author Eric Zhao |
|
|
* @author Eric Zhao |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@SpiOrder(-3500) |
|
|
public class DemoSlot extends AbstractLinkedProcessorSlot<DefaultNode> { |
|
|
public class DemoSlot extends AbstractLinkedProcessorSlot<DefaultNode> { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void entry(Context context, ResourceWrapper resourceWrapper, DefaultNode node, int count, boolean prioritized, Object... args) |
|
|
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 context: " + context.getName()); |
|
|
System.out.println("Current entry resource: " + context.getCurEntry().getResourceWrapper().getName()); |
|
|
System.out.println("Current entry resource: " + context.getCurEntry().getResourceWrapper().getName()); |
|
|
|
|
|
|
|
|