-
Notifications
You must be signed in to change notification settings - Fork 8.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
optimize: Enhance TCC annotation @BusinessActionContextParameter
#3728
Draft
wangliang181230
wants to merge
161
commits into
apache:2.x
Choose a base branch
from
wangliang181230:optimize/tcc_share_1_to_2
base: 2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
optimize: Enhance TCC annotation @BusinessActionContextParameter
#3728
wangliang181230
wants to merge
161
commits into
apache:2.x
from
wangliang181230:optimize/tcc_share_1_to_2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BusinessActionContext
before try
method, and @BusinessActionContextParameter(paramName)
can not be set BusinessActionContext
before Try
method, and @BusinessActionContextParameter(paramName)
can not be set
Codecov Report
@@ Coverage Diff @@
## develop #3728 +/- ##
=============================================
- Coverage 49.42% 49.23% -0.19%
+ Complexity 4115 4102 -13
=============================================
Files 736 737 +1
Lines 25721 25771 +50
Branches 3176 3186 +10
=============================================
- Hits 12713 12689 -24
- Misses 11662 11729 +67
- Partials 1346 1353 +7
|
BusinessActionContext
before Try
method, and @BusinessActionContextParameter(paramName)
can not be set BusinessActionContext
before Try
method, and @BusinessActionContextParameter(paramName)
don't need to set it up
…Context设置回arguments里的BUG修复。
BusinessActionContext
before Try
method, and @BusinessActionContextParameter(paramName)
don't need to set it upBusinessActionContext
before Try
method, and paramName
of @BusinessActionContextParameter
becomes optional
…ssActionContextUtil`
@BusinessActionContextParameter
@BusinessActionContextParameter
@BusinessActionContextParameter
@BusinessActionContextParameter
@BusinessActionContextParameter
@BusinessActionContextParameter
# Conflicts: # tcc/src/main/java/io/seata/rm/tcc/api/BusinessActionContextParameter.java # tcc/src/main/java/io/seata/rm/tcc/interceptor/ActionContextUtil.java # tcc/src/main/java/io/seata/rm/tcc/interceptor/ActionInterceptorHandler.java
…re_1_to_2 # Conflicts: # common/src/main/java/io/seata/common/util/ReflectionUtil.java # common/src/test/java/io/seata/common/util/ReflectionUtilTest.java # tcc/src/main/java/io/seata/rm/tcc/TCCResourceManager.java # tcc/src/main/java/io/seata/rm/tcc/api/BusinessActionContextParameter.java # tcc/src/main/java/io/seata/rm/tcc/interceptor/ActionContextUtil.java # tcc/src/main/java/io/seata/rm/tcc/interceptor/ActionInterceptorHandler.java # tcc/src/test/java/io/seata/rm/tcc/TccActionImpl.java
@BusinessActionContextParameter
@BusinessActionContextParameter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
optimize: Enhance TCC annotation
@BusinessActionContextParameter
@BusinessActionContextParameter(paramName)
becomes optional@BusinessActionContextParameter(index)
supports used to theArray
param or field@BusinessActionContextParameter
: add new propertyfecther
, it can custom the parameter fetcher. The defaultfetcher
isDefaultParameterFetcher
.优化:增强TCC注解
@BusinessActionContextParameter
的功能。@BusinessActionContextParameter
的paramName
或value
变为可选项。可以不用设置了,未设置时,TCC会自动读取方法参数名
或属性名
。// 注:要想自动获取到
方法参数名
,前提是源码编译命令需加上-parameters
参数进行编译。@BusinessActionContextParameter
的index
支持使用在Array
类型的参数或属性上。// 注:现已添加
ParameterFetcher
的功能,建议使用该功能来自定义获取列表或数组的数据。当
@BusinessActionContextParameter(isParamInProperty = true)
时,提取context的方法设置成了一个接口ParameterFetcher
,并可自定义实现。原来的fetch代码转移到默认接口实现DefaultParameterFetcher
中。目前,设想的
fetcher
的使用场景有以下两种:DefaultParameterFetcher
,使用的是反射来提取context,部分对性能要求比较高的用户,可自定义实现,来提升性能。DefaultParameterFetcher
无法满足需求时,可自定义实现来特殊处理。当
@BusinessActionContextParameter(isParamInProperty = true)
,同时paramName
或value
设置了值,那么从对象里读取到map会以paramName为key,添加到context中,而不是以每个属性名为key,属性值为value,逐个设置进去。// 警告:此改动,会影响同时使用
paramName
和isParamInProperty
属性的用户。但实际上,原来的功能,设置了isParamInProperty=true
后,再设置paramName
也是没有意义的(正因为这样使用没有意义,所以才想到扩展这种使用方式)。伪代码讲解优化4的变化:
actionContext.put(paramName, map)
map.forEach((key, value) -> { actionContext.put(key, value); });