Skip to content
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

bugfix: fix hsf isReference bug #6033

Merged
merged 2 commits into from
Nov 16, 2023
Merged

bugfix: fix hsf isReference bug #6033

merged 2 commits into from
Nov 16, 2023

Conversation

leezongjie
Copy link
Contributor

@leezongjie leezongjie commented Nov 14, 2023

image

image

在使用了hsf框架的环境下,任何FactoryBean实例都会被该方法判断为true

fixes #6032

@leezongjie leezongjie changed the title [bugfix] HSFRemotingParser中关于isReference的解析处理有问题 #6032 [bugfix] HSFRemotingParser中关于isReference的解析处理有问题 Nov 14, 2023
@leezongjie leezongjie changed the title [bugfix] HSFRemotingParser中关于isReference的解析处理有问题 [bugfix] fix_hsf_isReference_judge Nov 14, 2023
@funky-eyes funky-eyes changed the title [bugfix] fix_hsf_isReference_judge bugfix: fix hsf isReference bug Nov 14, 2023
@funky-eyes funky-eyes added this to the 2.0.0 milestone Nov 14, 2023
Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/intergration-tx-api intergration-tx-api labels Nov 14, 2023
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #6033 (d6e6882) into 2.x (abfafc3) will increase coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6033      +/-   ##
============================================
+ Coverage     49.56%   49.57%   +0.01%     
- Complexity     4748     4749       +1     
============================================
  Files           907      907              
  Lines         31284    31284              
  Branches       3770     3770              
============================================
+ Hits          15506    15510       +4     
+ Misses        14246    14244       -2     
+ Partials       1532     1530       -2     
Files Coverage Δ
...tion/tx/api/remoting/parser/HSFRemotingParser.java 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@leezongjie
Copy link
Contributor Author

RemotingFactoryBeanParser生效流程:

2.x版本中,GlobalTransactionScanner实际会把所有的FactoryBean类型都在扫描中过滤掉,而直接对FactoryBean生产的目标bean做解析是无法判断为rpc reference的,因此需要RemotingFactoryBeanParser来处理。
比如一个rpc reference bean是由FactoryBean工厂生成的,则在扫描过程中,其他parser对该bean都无法做成判断时,由RemotingFactoryBeanParser来尝试取创建当前bean的工厂FactoryBean,如hsf中的工厂为HSFSpringConsumerBean,则可以继续进入HSFRemotingParser并且校验isReference成功。

HSFRemotingParser中原先的判断("com.taobao.hsf.app.spring.util.HSFSpringConsumerBean".equals(beanClassName) || "org.springframework.beans.factory.FactoryBean".equals(beanClassName));

其中
"org.springframework.beans.factory.FactoryBean".equals(beanClassName)实际上并不会造成问题,应该是多余的,FactoryBean是一个接口类,从一个实现类取beanClassName做相等比较,该判断表达式应该恒为false。

该pr内容在hsf环境下测试通过。

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@slievrly slievrly merged commit 3e9a46e into apache:2.x Nov 16, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/intergration-tx-api intergration-tx-api type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bugfix] HSFRemotingParser中关于isReference的解析处理有问题
3 participants