public final class Scheduler extends Object
Modifier and Type | Method and Description |
---|---|
static void |
cancelAllTasks()
Cancels all running tasks/threads and clears the cached queue.
|
static ScheduledExecutorService |
getService()
Returns the underlying
ScheduledExecutorService used for this
utility class |
static ScheduledFuture<?> |
runAsyncTask(Runnable r,
long delay)
Runs a single asynchronous task
|
static ScheduledFuture<?> |
runAsyncTaskRepeat(Runnable r,
long startAfter,
long delay)
Runs a repeating asynchronous task
|
static ScheduledFuture<?> |
runCallable(Callable<?> c,
long delay)
Runs a Callable
|
public static ScheduledFuture<?> runAsyncTaskRepeat(Runnable r, long startAfter, long delay)
r
- The runnable to executestartAfter
- Time (in seconds) to wait before executiondelay
- Time (in seconds) between execution to waitpublic static ScheduledFuture<?> runAsyncTask(Runnable r, long delay)
r
- The runnable to executedelay
- Time (in seconds) to wait before executionpublic static ScheduledFuture<?> runCallable(Callable<?> c, long delay)
c
- The callable to executedelay
- Time (in seconds) to wait before executionpublic static void cancelAllTasks()
public static ScheduledExecutorService getService()
ScheduledExecutorService
used for this
utility classScheduledExecutorService
Copyright © 2015. All rights reserved.