V
- The result type returned by the get method of the Future that is associated with this task.public class SchedulableTask<V> extends FutureTask<V> implements RunnableScheduledFuture<V>
Constructor and Description |
---|
SchedulableTask(Callable<V> callable,
RunnableScheduledFuture<V> innerTask)
Creates a task that can be scheduled with
TaskScheduler . |
SchedulableTask(Runnable runnable,
V result,
RunnableScheduledFuture<V> innerTask)
Creates a task that can be scheduled with
TaskScheduler . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Delayed task) |
long |
getDelay(TimeUnit unit) |
boolean |
isPeriodic() |
void |
run() |
cancel, done, get, get, isCancelled, isDone, runAndReset, set, setException
protected final String name
public SchedulableTask(Runnable runnable, V result, RunnableScheduledFuture<V> innerTask)
TaskScheduler
.runnable
- The user-defined task to execute.result
- The result to return upon success. Use null if the task does not return a result along with
Void as generic object type.innerTask
- The inner task instantiated internally by the executor that we decorate with this class.public SchedulableTask(Callable<V> callable, RunnableScheduledFuture<V> innerTask)
TaskScheduler
.callable
- The user-defined task to execute.innerTask
- The inner task instantiated internally by the executor that we decorate with this class.public void run()
run
in interface Runnable
run
in interface RunnableFuture<V>
run
in class FutureTask<V>
public boolean isPeriodic()
isPeriodic
in interface RunnableScheduledFuture<V>
public int compareTo(Delayed task)
compareTo
in interface Comparable<Delayed>
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.