public class ScheduledRunnableComponent
extends java.lang.Object
Constructor and Description |
---|
ScheduledRunnableComponent() |
Modifier and Type | Method and Description |
---|---|
boolean |
cancelTask(java.lang.String taskName,
boolean mayInterruptIfRunning) |
<any> |
getTask(java.lang.String taskName) |
java.util.concurrent.ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.String taskName,
java.lang.Runnable runnable,
long initialDelay,
long period,
java.util.concurrent.TimeUnit timeUnit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the given
period; that is executions will commence after
initialDelay then initialDelay+period, then
initialDelay + 2 * period, and so on.
|
<T> java.util.concurrent.ScheduledFuture<T> |
scheduleOnce(java.lang.String taskName,
java.util.concurrent.Callable<T> callable,
long delay,
java.util.concurrent.TimeUnit timeUnit)
Creates and executes a ScheduledFuture that becomes enabled after the
given delay.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleOnce(java.lang.String taskName,
java.lang.Runnable runnable,
long delay,
java.util.concurrent.TimeUnit timeUnit)
Creates and executes a one-shot action that becomes enabled
after the given delay.
|
java.util.concurrent.ScheduledFuture<?> |
scheduleUntilSuccessful(java.lang.String taskName,
java.util.concurrent.Callable<java.lang.Boolean> callable,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit timeUnit) |
java.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.String taskName,
java.lang.Runnable runnable,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit timeUnit)
Creates and executes a periodic action that becomes enabled first
after the given initial delay, and subsequently with the
given delay between the termination of one execution and the
commencement of the next.
|
public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.String taskName, java.lang.Runnable runnable, long initialDelay, long delay, java.util.concurrent.TimeUnit timeUnit)
taskName
- a unique identifier for this task. This can be used to look up or cancel the task at a later
time.runnable
- the task to executeinitialDelay
- the time to delay first executiondelay
- the delay between the termination of one
execution and the commencement of the nexttimeUnit
- the time unit of the initialDelay and delay parametersjava.util.concurrent.RejectedExecutionException
- if the task cannot be
scheduled for executionjava.lang.NullPointerException
- if command is nulljava.lang.IllegalArgumentException
- if delay less than or equal to zeropublic java.util.concurrent.ScheduledFuture<?> scheduleUntilSuccessful(java.lang.String taskName, java.util.concurrent.Callable<java.lang.Boolean> callable, long initialDelay, long delay, java.util.concurrent.TimeUnit timeUnit)
public java.util.concurrent.ScheduledFuture<?> scheduleOnce(java.lang.String taskName, java.lang.Runnable runnable, long delay, java.util.concurrent.TimeUnit timeUnit)
taskName
- a unique identifier for this task. This can be used to look up or cancel the task at a later
time.runnable
- the task to executedelay
- the time from now to delay executiontimeUnit
- the time unit of the delay parameterjava.util.concurrent.RejectedExecutionException
- if the task cannot be
scheduled for executionjava.lang.NullPointerException
- if command is nullpublic <T> java.util.concurrent.ScheduledFuture<T> scheduleOnce(java.lang.String taskName, java.util.concurrent.Callable<T> callable, long delay, java.util.concurrent.TimeUnit timeUnit)
taskName
- a unique identifier for this task. This can be used to look up or cancel the task at a later
time.callable
- the function to executedelay
- the time from now to delay executiontimeUnit
- the time unit of the delay parameterjava.util.concurrent.RejectedExecutionException
- if the task cannot be
scheduled for executionjava.lang.NullPointerException
- if command is nullpublic java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.String taskName, java.lang.Runnable runnable, long initialDelay, long period, java.util.concurrent.TimeUnit timeUnit)
taskName
- a unique identifier for this task. This can be used to look up or cancel the task at a later
time.runnable
- the task to executeinitialDelay
- the time to delay first executionperiod
- the period between successive executionstimeUnit
- the time unit of the initialDelay and period parametersjava.util.concurrent.RejectedExecutionException
- if the task cannot be
scheduled for executionjava.lang.NullPointerException
- if command is nulljava.lang.IllegalArgumentException
- if period less than or equal to zeropublic boolean cancelTask(java.lang.String taskName, boolean mayInterruptIfRunning)
public <any> getTask(java.lang.String taskName)