public abstract class AbstractSubmitterScheduler extends AbstractSubmitterExecutor implements SubmitterScheduler
AbstractSubmitterExecutor this abstract class is designed to reduce code
duplication for the multiple schedule functions. This includes error checking, as well as
wrapping things up in ListenableFutureTask's if necessary. In general this wont be
useful outside of Threadly developers, but must be a public interface since it is used in
sub-packages.
If you do find yourself using this class, please post an issue on github to tell us why. If there is something you want our schedulers to provide, we are happy to hear about it.
| Constructor and Description |
|---|
AbstractSubmitterScheduler() |
| Modifier and Type | Method and Description |
|---|---|
void |
schedule(java.lang.Runnable task,
long delayInMs)
Schedule a one time task with a given delay.
|
<T> ListenableFuture<T> |
submitScheduled(java.util.concurrent.Callable<T> task,
long delayInMs)
Schedule a
Callable with a given delay. |
<T> ListenableFuture<T> |
submitScheduled(java.lang.Runnable task,
T result,
long delayInMs)
Schedule a task with a given delay.
|
execute, submit, submitequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitscheduleAtFixedRate, scheduleWithFixedDelay, submitScheduledsubmit, submit, submitpublic void schedule(java.lang.Runnable task,
long delayInMs)
SubmitterSchedulerschedule in interface SubmitterSchedulertask - runnable to executedelayInMs - time in milliseconds to wait to execute taskpublic <T> ListenableFuture<T> submitScheduled(java.lang.Runnable task, T result, long delayInMs)
SubmitterSchedulerFuture.get() method will return
the provided result once the runnable has completed.submitScheduled in interface SubmitterSchedulerT - type of result returned from the futuretask - runnable to executeresult - result to be returned from resulting future .get() when runnable completesdelayInMs - time in milliseconds to wait to execute taskpublic <T> ListenableFuture<T> submitScheduled(java.util.concurrent.Callable<T> task, long delayInMs)
SubmitterSchedulerCallable with a given delay. This is needed when a result needs to be
consumed from the callable.submitScheduled in interface SubmitterSchedulerT - type of result returned from the futuretask - callable to be executeddelayInMs - time in milliseconds to wait to execute task