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

Support RunOnVirtualThread annotations on beans implementing a JAX-RS interface #45202

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

danielbobbert
Copy link
Contributor

Fixes: #45186

This PR is about support for beans that implement a JAX-RS interface.

It does four things:

  • fix the resteasy EndpointIndexer such that explicit annotations on the bean overwrite the defaultBlocking
  • Extend the JaxRsMethodProcessor such that the ExecutionModelAnnotationsProcessor will not complain about RunOnVirtualThread annotations on the bean
  • Extend the ResteasyReactiveScanner to allow @RunOnVirualThread annotations on the JAX-RS Application to set the defaultBlocking
  • Add integration tests for beans implementing a JAX-RS interface with @RunOnVirtualThread annotations either on the method or on the bean class

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! I will let @cescoffier check this PR but I asked for a small change to improve clarity.


private boolean testMethod(MethodInfo method) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we rename it isJaxrsResourceMethod() or something similar?

Copy link
Contributor Author

@danielbobbert danielbobbert Dec 20, 2024

Choose a reason for hiding this comment

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

Sure, can do. @cescoffier Any other comments from your side?
Besides that, I was wondering about the "shortcut" that was already present in the original code: If there is a @Path annotation on the class, all methods pass the test. But a JAX-RS could contain JAX-RS methods (annotated with @GET etc.) and also some (un-annotated) "helper" methods that are used internally by the JAX-RS methods. Now, @RunOnVirtualThread only makes sense on the JAX-RS methods and not on the helper methods, so I was wondering what the reasoning of the "shortcut" was and whether it is actually valid?
On the other hand, I don't know how "exact" this whole test needs to be. It seems to be checking method annotations only (and not class annotations) at this time anyways, so maybe it's "close enough" to prevent people from putting @RunOnVirtualThread in absurd places?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have renamed the method and rebased the branch

This comment has been minimized.

@danielbobbert danielbobbert force-pushed the main branch 5 times, most recently from 136d539 to fedbd80 Compare December 28, 2024 20:03
@danielbobbert danielbobbert force-pushed the main branch 2 times, most recently from 2fa906a to c5a2d35 Compare January 3, 2025 11:26
Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

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

LGTM

@cescoffier
Copy link
Member

Thanks, looks good to me!

About your comment, @geoand any idea why we have this shortcut?

Copy link

quarkus-bot bot commented Jan 6, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 39e811b.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

@danielbobbert
Copy link
Contributor Author

No pressure, but the question about the "shortcut" is of general nature and independent from my actual PR. So I would really love to see this merged, since the bug heavily blocks our development right now.

@geoand
Copy link
Contributor

geoand commented Jan 6, 2025

Thanks, looks good to me!

About your comment, @geoand any idea why we have this shortcut?

Unfortunately not

@danielbobbert
Copy link
Contributor Author

Is there anything else I could do to help get this merged?

@geoand geoand merged commit b593f42 into quarkusio:main Jan 7, 2025
46 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VirtualThreads cannot be used with JAX-RS interfaces
4 participants