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

Vertx should build its virtual thread factory at runtime with correct reflection calls #5169

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

vietj
Copy link
Member

@vietj vietj commented Mar 26, 2024

A Vertx uses cached reflection to build the virtual thread factory in order to remain compatible with Java 8. When running in a native image Vert.x will assume that the runtime might not have virtual thread incorrectly.

Defer the virtual thread factory availability when a Vertx instance is created, in addition declares that virtual thread factory API should not be cached so the Vertx instance is able to build the virtual thread factory correctly.

Native image metadata are held in the native-image classifier jar since this is experimental and might collide with existing solution for managing native image where framework is embedded.

@vietj vietj added this to the 4.5.7 milestone Mar 26, 2024
@vietj vietj added the bug label Mar 26, 2024
@vietj vietj self-assigned this Mar 26, 2024
@vietj
Copy link
Member Author

vietj commented Mar 26, 2024

@cescoffier can you have a quick look ? this solves the runtime virtual thread factory detection problem

Copy link
Contributor

@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.

I need to have a closer look, as it will affects how we initialize Vert.x in native image in Quarkus.

@vietj vietj changed the title Vertx should be its virtual thread factory at runtime with correct reflection calls Vertx should build its virtual thread factory at runtime with correct reflection calls Mar 26, 2024
@vietj vietj requested a review from cescoffier March 27, 2024 09:00
vietj added 2 commits March 27, 2024 14:44
… order to remain compatible with Java 8. When running in a native image Vert.x will assume that the runtime might not have virtual thread incorrectly.

Defer the virtual thread factory availability when a Vertx instance is created, in addition declares that virtual thread factory API should not be cached so the Vertx instance is able to build the virtual thread factory correctly.
…classifier instead of the default jar artifact.
@vietj vietj force-pushed the virtual-thread-factory-with-native-image-4.x branch from 933c1c2 to c39c65e Compare March 27, 2024 13:47
@vietj vietj merged commit 04e744f into 4.x Mar 27, 2024
7 checks passed
@vietj vietj deleted the virtual-thread-factory-with-native-image-4.x branch March 27, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants