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

CompletableFuture smart dispatch support #30121

Merged
merged 2 commits into from
Jan 10, 2023
Merged

Conversation

franz1981
Copy link
Contributor

@franz1981 franz1981 commented Jan 2, 2023

@franz1981
Copy link
Contributor Author

@cescoffier Not sure I made it right, I see lot of duplicate codes :/
I will create a separate issue in case it seems a good use case

The reason why I've done it is on this Quarkus profiling workshop snippet where I've been forced to use CompletionStage in order to use the I/O threads, while failing (ie using the blocking thread pool) with the actual concrete type CompletableFuture.

@cescoffier
Copy link
Member

What's the rationale? We strongly recommend Uni in this case (for plenty of reason including context handling).

@cescoffier
Copy link
Member

So basically, do you have the same issue when using Uni instead of CS?

@franz1981
Copy link
Contributor Author

So basically, do you have the same issue when using Uni instead of CS?

The issue is related of how we recognize non-blocking endpoint: CS isn't CF and it's going to use a thread pool for that, that's unexpected from a user pov

@cescoffier
Copy link
Member

Ah ok, it makes sense (even if I would prefer users to move away from CS/CF as fast as they can)

@franz1981
Copy link
Contributor Author

franz1981 commented Jan 2, 2023

Ah ok, it makes sense (even if I would prefer users to move away from CS/CF as fast as they can)

Yep and still my changes are not correctly handling polymorphism there (if someone impl their own CompletionStage children my changes won't help to detect it), given that's not an high prio thing I'm happy to close it unless can still be useful to someone other then me and Mario for the workshop: let me know and I can happily close this ;)

@geoand
Copy link
Contributor

geoand commented Jan 3, 2023

Also, do we really want to do this when RESTEasy Reactive already has support for it?

@franz1981 franz1981 force-pushed the 17037_cf branch 2 times, most recently from 4f2966b to 8f2c20f Compare January 3, 2023 08:16
@franz1981 franz1981 changed the title Reactive routes - support CompletableFuture as a method return type CompletableFuture smart dispatch support Jan 3, 2023
@franz1981 franz1981 marked this pull request as ready for review January 3, 2023 08:17
@franz1981
Copy link
Contributor Author

@geoand Renaming should look better and I've opened an enhancement request: cannot tell if it's a bug or a missing feature really

@quarkus-bot quarkus-bot bot added the area/rest label Jan 3, 2023
@franz1981 franz1981 force-pushed the 17037_cf branch 4 times, most recently from 0f700af to c923eec Compare January 3, 2023 10:36
Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

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

Thanks!

@geoand geoand added triage/backport-2.13? triage/waiting-for-ci Ready to merge when CI successfully finishes labels Jan 3, 2023
@quarkus-bot

This comment has been minimized.

@geoand
Copy link
Contributor

geoand commented Jan 4, 2023

CI is complaining :(

@franz1981
Copy link
Contributor Author

CI is complaining :(

yep, let me check what going on

@franz1981
Copy link
Contributor Author

@geoand it seems that ServletSimpleRestTestCase::testAsync is failing to run on the I/O thread even if I switch to CompletionStage type on the endpoint signature...is it supposed to happen? @cescoffier too

@geoand
Copy link
Contributor

geoand commented Jan 4, 2023

Servlet is always meant to run on a worker thread.

I am looking for the piece of code that checks this

@franz1981
Copy link
Contributor Author

Oki so I can just disable that test for the servlet use case

@geoand
Copy link
Contributor

geoand commented Jan 4, 2023

Yeah, that makes sense

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@geoand
Copy link
Contributor

geoand commented Jan 9, 2023

I fixed the formatting issue and rebased the PR onto main.

@geoand geoand merged commit 06b1308 into quarkusio:main Jan 10, 2023
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Jan 10, 2023
@quarkus-bot quarkus-bot bot added kind/enhancement New feature or request and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Jan 10, 2023
@gsmet gsmet modified the milestones: 2.16.0.CR1, 2.13.7.Final Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CompletableFuture smart dispatch support
4 participants