当前位置:网站首页>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 .
边栏推荐
- C# 练习。类列表加记录,显示记录和清空记录
- ImageView, glide load long picture (glide load picture)
- Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023
- Flutter TextField详解
- On the origin of the dispute between the tradition and the future of database -- AWS series column
- Invocation failed Unexpected end of file from server
- MySQL - database creation and management
- Jz-062- the k-th node of binary search tree
- 抖音实战~首页视频~下拉刷新
- Bonne Recommandation: développer des outils de sécurité pour les terminaux mobiles
猜你喜欢

论数据库的传统与未来之争之溯源溯本----AWS系列专栏

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

Web resource preloading - production environment practice
MySQL中存储过程的详细详解

Bonne Recommandation: développer des outils de sécurité pour les terminaux mobiles

Keep alive cache component in Vue

Preliminary analysis of serial port printing and stack for arm bare board debugging

On the escape of inequality value

品达通用权限系统(Day 3~Day 4)

Three basic backup methods of mongodb
随机推荐
Feign远程调用
JS mobile terminal touch screen event
论数据库的传统与未来之争之溯源溯本----AWS系列专栏
Database SQL statement writing
抖音实战~搜索页面~扫描二维码
MySQL - table creation and management
Development of NFT for digital collection platform
Basic and necessary common plug-ins of vscade
Development principle analysis and source code of dapp-lp single and dual currency liquidity pledge mining system
Kubernetes 资源拓扑感知调度优化
Boot指标监测
C language file cursor fseek
460million zongzi were sold in half a year. How big is the "imagination space" of time-honored brands?
Nftgamefi chain game system development detailed solution - chain game system development principle analysis
Boot的单元测试
Tiktok practice ~ sharing module ~ copy short video link
威胁猎人必备的六个威胁追踪工具
Tiktok practice ~ sharing module ~ generate short video QR code
【推荐收藏】这8个常用缺失值填充技巧一定要掌握
SentinelResource注解详解