Caused by: com.alibaba.csp.sentinel.slots.block.flow.FlowException: null

在使用sentinel做限流的时候,报了这个错:

Caused by: com.alibaba.csp.sentinel.slots.block.flow.FlowException: null_第1张图片

原代码如下:

@Service
public class SentinelService {
    @SentinelResource(value = "SentinelService.success", blockHandler = "fail")
    public String success() {
        System.out.println("success 请求正常");
        return "success";
    }

    public String fail() {
        System.out.println("阻塞");
        return "fail";
    }

}

排查原因:发现fail() 中少了BlockException参数,

Caused by: com.alibaba.csp.sentinel.slots.block.flow.FlowException: null_第2张图片

加上后测试,用15个线程并发测

Caused by: com.alibaba.csp.sentinel.slots.block.flow.FlowException: null_第3张图片完成!

你可能感兴趣的:(微服务,微服务)