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, submit
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
scheduleAtFixedRate, scheduleWithFixedDelay, submitScheduled
submit, submit, submit
public void schedule(java.lang.Runnable task, long delayInMs)
SubmitterScheduler
schedule
in interface SubmitterScheduler
task
- runnable to executedelayInMs
- time in milliseconds to wait to execute taskpublic <T> ListenableFuture<T> submitScheduled(java.lang.Runnable task, T result, long delayInMs)
SubmitterScheduler
Future.get()
method will return
the provided result once the runnable has completed.submitScheduled
in interface SubmitterScheduler
T
- 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)
SubmitterScheduler
Callable
with a given delay. This is needed when a result needs to be
consumed from the callable.submitScheduled
in interface SubmitterScheduler
T
- type of result returned from the futuretask
- callable to be executeddelayInMs
- time in milliseconds to wait to execute task