Skip to content

Commit

Permalink
Call init on delegate from TimedScheduler
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
luukveenis committed Aug 20, 2024
1 parent 63d25e9 commit ae3998a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ public void start() {
delegate.start();
}

@Override
public void init() {
delegate.init();
}

static final class TimedWorker implements Worker {

final TimedScheduler parent;
Expand Down

0 comments on commit ae3998a

Please sign in to comment.