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

fix: Scan all interfaces implemented by the jdk proxy class #695

Merged
merged 10 commits into from
Apr 3, 2019
Merged

fix: Scan all interfaces implemented by the jdk proxy class #695

merged 10 commits into from
Apr 3, 2019

Conversation

XCXCXCXCX
Copy link
Contributor

Ⅰ. Describe what this PR did

pull request #660 for supplement

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@XCXCXCXCX
Copy link
Contributor Author

There is a small part of the conflict that needs to be resolved.

@slievrly
Copy link
Member

@XCXCXCXCX please resolve conflicts

@codecov-io
Copy link

codecov-io commented Mar 31, 2019

Codecov Report

Merging #695 into develop will decrease coverage by 0.02%.
The diff coverage is 42.3%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #695      +/-   ##
=============================================
- Coverage      32.68%   32.65%   -0.03%     
- Complexity       894      898       +4     
=============================================
  Files            226      226              
  Lines           8792     8806      +14     
  Branches        1058     1063       +5     
=============================================
+ Hits            2874     2876       +2     
- Misses          5595     5602       +7     
- Partials         323      328       +5
Impacted Files Coverage Δ Complexity Δ
...m/alibaba/fescar/spring/util/SpringProxyUtils.java 5.66% <10%> (+1%) 3 <1> (+1) ⬆️
...ar/spring/annotation/GlobalTransactionScanner.java 51.76% <62.5%> (-1.33%) 15 <5> (+3)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8df60e1...7d9ade8. Read the comment docs.

@jovany-wang
Copy link
Contributor

I can't see any changes in this PR.

@XCXCXCXCX
Copy link
Contributor Author

Sorry, in order to let CI pass, I restored the code, now I resubmit the code.Please see if there is any problem.

@zhangthen
Copy link
Contributor

What changed is this PR?

@XCXCXCXCX
Copy link
Contributor Author

Just for the supplement of pr#660, the previous implementation will only scan the first interface of the jdk dynamic proxy implementation. If the jdk dynamic proxy has multiple interfaces, it will probably ignore some objects that need to be intercepted by the GlobalTransactionalInterceptor.

@zhangthen zhangthen self-requested a review April 1, 2019 06:47
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

Copy link
Contributor

@zhangthen zhangthen left a comment

Choose a reason for hiding this comment

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

+1

return proxy.getClass();
}
}

public static Class<?>[] findInterfaces(Object proxy) throws Exception {
if(AopUtils.isJdkDynamicProxy(proxy)){
Copy link
Contributor

Choose a reason for hiding this comment

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

Only check jdk proxy ? What to do if it's a cglib proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it's a CGLIB proxy class, I don't think it's necessary to consider whether the interface it implements needs to be proxyed, otherwise we should refactor it, scan all normal classes, its parent class, and the interfaces it implements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why we need to scan the jdk proxy is that there are many such implementations :
only the interface exists, there is no specific implementation class, the user can only mark the implementation of the fescar interception on the interface.

@zhangthen zhangthen merged commit acdd872 into apache:develop Apr 3, 2019
@wangliang181230 wangliang181230 added this to the 0.4.* milestone Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants