public class ScheduledTask extends BasicTask
Note that some termination logic, including BasicTask.addListener(Runnable, java.util.concurrent.Executor)
,
is not precisely defined.
BasicTask.SubmissionErrorCatchingExecutor, BasicTask.TaskFinalizer
description, displayName, NO_OP, WARN_IF_NOT_RUN
Constructor and Description |
---|
ScheduledTask(java.util.concurrent.Callable<Task<?>> taskFactory) |
ScheduledTask(java.util.Map flags,
java.util.concurrent.Callable<Task<?>> taskFactory) |
ScheduledTask(java.util.Map flags,
Task<?> task) |
ScheduledTask(Task<?> task) |
Modifier and Type | Method and Description |
---|---|
void |
blockUntilEnded()
Causes calling thread to block until the task is ended.
|
void |
blockUntilFirstScheduleStarted() |
boolean |
blockUntilNextRunFinished(Duration timeout)
internal method used to allow callers to wait for underlying tasks to finished in the case of cancellation
|
boolean |
cancel(boolean mayInterrupt)
As
Future.cancel(boolean) . |
ScheduledTask |
delay(Duration d) |
ScheduledTask |
delay(long val) |
java.lang.Object |
get()
gets the value of the most recently run task
|
java.util.concurrent.ScheduledFuture<?> |
getNextScheduled() |
int |
getRunCount() |
java.util.concurrent.Callable<Task<?>> |
getTaskFactory() |
boolean |
isDone() |
ScheduledTask |
maxIterations(int val) |
Task<?> |
newTask() |
ScheduledTask |
period(Duration d) |
ScheduledTask |
period(long val) |
addListener, applyTagModifier, asTask, blockUntilEnded, blockUntilStarted, blockUntilStarted, cancel, equals, get, get, getBlockingDetails, getBlockingTask, getDescription, getDisplayName, getEndTimeUtc, getExtraStatusText, getId, getInternalFuture, getJob, getListeners, getMutableTags, getProxyTarget, getQueuedTimeUtc, getStartTimeUtc, getStatusDetail, getStatusSummary, getSubmittedByTask, getSubmitTimeUtc, getTags, getThread, getUnchecked, getUnchecked, hashCode, ignoreIfNotRun, initInternalFuture, isBegun, isCancelled, isError, isQueued, isQueuedAndNotSubmitted, isQueuedOrSubmitted, isSubmitted, markQueued, resetBlockingDetails, resetBlockingTask, runListeners, setBlockingDetails, setBlockingTask, setEndTimeUtc, setExtraStatusText, setFinalizer, setJob, setStartTimeUtc, setSubmittedByTask, setSubmitTimeUtc, setThread, toString, uncancel
public ScheduledTask(java.util.concurrent.Callable<Task<?>> taskFactory)
public ScheduledTask(Task<?> task)
public ScheduledTask(java.util.Map flags, Task<?> task)
public ScheduledTask(java.util.Map flags, java.util.concurrent.Callable<Task<?>> taskFactory)
public int getRunCount()
public java.util.concurrent.ScheduledFuture<?> getNextScheduled()
public ScheduledTask delay(Duration d)
public ScheduledTask delay(long val)
public ScheduledTask period(Duration d)
public ScheduledTask period(long val)
public ScheduledTask maxIterations(int val)
public java.util.concurrent.Callable<Task<?>> getTaskFactory()
public Task<?> newTask()
public boolean isDone()
public void blockUntilFirstScheduleStarted()
public void blockUntilEnded()
Task
Either normally or by cancellation or error, but without throwing error on cancellation or error. (Errors are logged at debug.)
blockUntilEnded
in interface Task
blockUntilEnded
in class BasicTask
public java.lang.Object get() throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
public boolean cancel(boolean mayInterrupt)
Task
Future.cancel(boolean)
. Note that Future.isDone()
and Task.blockUntilEnded(Duration)
return immediately
once a task is cancelled, consistent with the underlying FutureTask
behaviour.
TODO Fine-grained control over underlying jobs, e.g. to ensure anything represented by this task is actually completed,
is not (yet) publicly exposed. See the convenience method blockUntilInternalTasksEnded in the Tasks set of helpers
for more discussion.@Beta public boolean blockUntilNextRunFinished(Duration timeout)
duration
-