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

Allow override of scheduler #3132

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -8,6 +8,7 @@
import java.util.Locale;
import java.util.Set;
import java.util.SortedMap;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
Expand Down Expand Up @@ -166,7 +167,7 @@ synchronized void start(long initialDelay, long period, TimeUnit unit, Runnable
throw new IllegalArgumentException("Reporter already started");
}

this.scheduledFuture = getScheduledFuture(initialDelay, period, unit, runnable);
this.scheduledFuture = getScheduledFuture(initialDelay, period, unit, runnable, executor);
}


Expand All @@ -177,7 +178,7 @@ synchronized void start(long initialDelay, long period, TimeUnit unit, Runnable
*
* Overriding this in a subclass to revert to the old behavior is permitted.
*/
protected ScheduledFuture<?> getScheduledFuture(long initialDelay, long period, TimeUnit unit, Runnable runnable) {
protected ScheduledFuture<?> getScheduledFuture(long initialDelay, long period, TimeUnit unit, Runnable runnable, ScheduledExecutorService executor) {
return executor.scheduleWithFixedDelay(runnable, initialDelay, period, unit);
}
dkaukov marked this conversation as resolved.
Show resolved Hide resolved

Expand Down