-
Notifications
You must be signed in to change notification settings - Fork 3k
Dispatch Mutiny scheduled operations using Vert.x timers when possible #51395
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
Dispatch Mutiny scheduled operations using Vert.x timers when possible #51395
Conversation
bed5efc to
6509d20
Compare
|
Thank you for this improvement! Just tried it out locally and I can remove my workaround :) |
|
Thanks @wjglerum that's good news! I'm waiting for some CI runs to see if anything suspicious is here. |
|
Thanks @FroMage It worked on my local CI |
|
Also ping @vietj |
ozangunalp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small note for the ExecutorService delegation, otherwise looks good!
...ime/src/main/java/io/quarkus/vertx/core/runtime/VertxTimerAwareScheduledExecutorService.java
Outdated
Show resolved
Hide resolved
e544f81 to
da02125
Compare
This comment has been minimized.
This comment has been minimized.
Some Mutiny operations such as delaying an item, performing a retry, or generating streams from periodic ticks all require a ScheduledExecutorService. This introduces a wrapper ScheduledExecutorService that dispatches some of the operations to Vert.x timers when called from a Vert.x event-loop, offering a more natural threading mental model as well as avoiding thread hops between worker threads and event-loops. The implementation only tunes Mutiny with that Vert.x-aware wrapper ScheduledExecutorService from the quarkus-vertx extension because non-server applications might not have Vert.x available. We also introduce an artificial build item in the Mutiny extension to ensure that the Vert.x build items always execute after those from Mutiny, or else we could have cases where Mutiny re-installs a non-Vert.x aware scheduler in its own configuration. Fixes: quarkusio#50918
…areScheduledExecutorService
This is an early design refactoring leftover.
32407be to
23f9d82
Compare
This comment has been minimized.
This comment has been minimized.
Status for workflow
|
Some Mutiny operations such as delaying an item, performing a retry, or generating streams
from periodic ticks all require a ScheduledExecutorService.
This introduces a wrapper ScheduledExecutorService that dispatches some of the operations
to Vert.x timers when called from a Vert.x event-loop, offering a more natural threading
mental model as well as avoiding thread hops between worker threads and event-loops.
The implementation only tunes Mutiny with that Vert.x-aware wrapper ScheduledExecutorService
from the quarkus-vertx extension because non-server applications might not have Vert.x available.
We also introduce an artificial build item in the Mutiny extension to ensure that the Vert.x build
items always execute after those from Mutiny, or else we could have cases where Mutiny re-installs
a non-Vert.x aware scheduler in its own configuration.
Unishould not move the context to an executor thread in Quarkus #50918