-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Call init() on delegate from TimedScheduler #3876
Conversation
@luukveenis Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
1 similar comment
@luukveenis Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
The TimedScheduler class doesn't currently provide an override for the `init()` method, which means it calls the default implementation on the interface that delegates to `start()`. This works fine for most schedulers, since they have a valid implementation of `start()`. However, the newer BoundedElasticThreadPerTaskScheduler throws an error for `start()`, so wrapping it in a TimedScheduler causes it to crash immediately when `init()` gets called. We should call the wrapped scheduler's `init()` method instead, which allows users to get metrics for their virtual thread schedulers.
deebee3
to
ae3998a
Compare
@luukveenis Thank you for signing the Contributor License Agreement! |
@luukveenis thanks! I took the liberty to add a test to your PR. |
Sorry I meant to add one, thank you! |
Thank you for the contribution, @luukveenis 🚀 |
This fixes an issue where wrapping a
BoundedElasticThreadPerTaskScheduler
withMicrometer#timedScheduler()
causes it to error out immediately.The TimedScheduler class doesn't currently override the
init()
method, so it calls the default from the interface, which delegates tostart()
. This works fine for other scheduler implementations because they still implementstart()
, but for the virtual thread scheduler, it simply throws an error. When we wrap it in a timed scheduler, it crashes on this error as soon asinit()
gets called.