当前位置:网站首页>Sentinelresource annotation details
Sentinelresource annotation details
2022-06-26 20:11:00 【A rookie is a great God】
SentinelResource annotation Attribute summary .
> This article is based on Sentinel 1.6.2, theoretical support 1.4.0+
| attribute | effect | Whether must |
|---|---|---|
| value | Resource name | yes |
| entryType | entry type , Mark the direction of the flow , Value IN/OUT, The default is OUT | no |
| blockHandler | Handle BlockException The function name of . Function requirements : 1. Must be public2. The return type is the same as the original method 3. The parameter type needs to match the original method , And add... At the end BlockException Parameters of type .4. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable blockHandlerClass , And designate blockHandlerClass The method inside . | no |
| blockHandlerClass | Deposit blockHandler Class . The corresponding processing function must be static modification , Otherwise, it cannot be parsed , Other requirements : Same as blockHandler. | no |
| fallback | Used to provide... When an exception is thrown fallback Processing logic .fallback Functions can be used for all types of exceptions ( except exceptionsToIgnore The types of exceptions excluded ) To deal with . Function requirements :1. The return type is the same as the original method 2. The parameter type needs to match the original method ,Sentinel 1.6 Start , Or at the end of the method Add Throwable Parameters of type .3. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable fallbackClass , And designate fallbackClass The method inside . | no |
| fallbackClass【1.6】 | Deposit fallback Class . The corresponding processing function must be static modification , Otherwise, it cannot be parsed , Other requirements : Same as fallback. | no |
| defaultFallback【1.6】 | For general purpose fallback Logic . Default fallback Functions can be used for all types of exceptions ( except exceptionsToIgnore The types of exceptions excluded ) To deal with . If you configure fallback and defaultFallback, With fallback Subject to . Function requirements :1. The return type is the same as the original method 2. The method parameter list is empty , Or there's a Throwable Parameters of type .3. By default, it needs to be in the same class as the original method . If you want to use functions of other classes , Configurable fallbackClass , And designate fallbackClass The method inside . | no |
| exceptionsToIgnore【1.6】 | Specify which exceptions to exclude . Excluded exceptions are not counted in the exception statistics , And will not enter fallback Logic , It's the same thing . | no |
| exceptionsToTrace | need trace It's abnormal | Throwable |
> TIPS
>
> - 1.6.0 Previous version fallback Function is only for degraded exceptions (DegradeException) To deal with , Can't handle business exceptions .
> - if blockHandler and fallback It's all configured , It is degraded by current limiting and thrown BlockException It will only enter blockHandler Processing logic . If not configured blockHandler、fallback and defaultFallback, When it is degraded by current limiting, it will BlockException Direct selling .
> - from 1.4.0 Version start , Annotation method definition resource supports automatic statistics of business exceptions , No manual call required Tracer.trace(ex) To record business exceptions .Sentinel 1.4.0 Previous versions needed to call themselves Tracer.trace(ex) To record business exceptions .
边栏推荐
- Jsonutils tool class (based on Alibaba fastjson)
- Jz-062- the k-th node of binary search tree
- Tree array
- Invocation failed Unexpected end of file from server
- 抖音实战~搜索页面~视频详情
- C primer plus学习笔记 —— 3、字符的IO(输入/输出)
- Wechat applet uniapp left slide delete with Delete Icon
- MySQL - database creation and management
- Can I open an account online? Is it safe?
- Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023
猜你喜欢

Convex hull problem

抖音实战~搜索页面~视频详情

Project practice 4: user login and token access verification (reids+jwt)

The successfully resolved idea cannot use the log normally after referencing Lombok's @slf4j

MySQL - subquery usage

云计算技术的发展与芯片处理器的关系

Basic and necessary common plug-ins of vscade

抖音实战~搜索页面~扫描二维码

Minimum spanning tree, shortest path, topology sorting, critical path

Installation and use of logstash
随机推荐
JSONUtils工具类(基于alibaba fastjson)
Can I open an account online? Is it safe?
Review of watermelon book (VII): Bayesian classifier (manual push + code demo)
When are global variables initialized before entering the main function?
Solve com mysql. jdbc. exceptions. jdbc4.MySQLNonTransientConnectionException: Could not create connection
阿里云个人镜像仓库日常基本使用
Arduino uno + DS1302 uses 31 byte static RAM to store data and print through serial port
Kubernetes resource topology aware scheduling optimization
Refresh the strong pointer assignment problem in the HP-UX system of Sanguan
30. concatenate substrings of all words
Feitian +cipu body brings more imagination to the metauniverse
Detailed explanation of stored procedures in MySQL
Is it safe to open a securities account? Is there any danger
When does the mobile phone video roll off?
网上办理中金财富开户安全吗?
8VC Venture Cup 2017 - Final Round C. Nikita and stack
慕课8、服务容错-Sentinel
Dynamic planning 111
stm32和电机开发(直流有刷电机和步进电机)
[recommended collection] these 8 common missing value filling skills must be mastered