public abstract class AbstractTask extends Object implements Task
Task.State
Constructor and Description |
---|
AbstractTask(TaskCoordinator coordinator,
ContainerTask<?> parent)
Constructor for Task.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDependent(AbstractTask dependent)
Adds dependent as a dependent of this task.
|
protected void |
addPrerequisite(AbstractTask prereq)
Adds prereq as a Prerequisite of this task.
|
protected void |
completeSubmit()
This method exists to allow a task to have no processing
|
protected void |
doSubmit()
This method submits a task to be executed and is called when all dependencies are completed for that task
This method should place a runnable on an executor or submit the task in some other way so that it will
run as soon as possible.
|
TaskCoordinator |
getCoordinator()
getCoordinator
|
TaskMonitor |
getMonitor()
getMonitor
|
protected boolean |
isScheduled()
This task has be sent to the TaskCoordinator to be run
|
protected void |
postSchedule()
postSchedule
|
protected void |
preSchedule()
preSchedule
|
void |
schedule()
This is called to add the task to the queue of tasks that can be considered to be runnable
|
String |
toString()
toString
|
void |
waitFor()
Wait for this task to complete.
|
boolean |
waitFor(long timeout,
TimeUnit unit)
Wait for this task to complete or until a timeout occurs
|
public AbstractTask(TaskCoordinator coordinator, ContainerTask<?> parent)
Constructor for Task.
coordinator
- a TaskCoordinator
object.parent
- a ContainerTask
object.public final TaskCoordinator getCoordinator()
getCoordinator
getCoordinator
in interface Task
TaskCoordinator
object.public final TaskMonitor getMonitor()
getMonitor
getMonitor
in interface Task
TaskMonitor
object.protected void doSubmit()
protected void completeSubmit()
public final void schedule()
protected void preSchedule()
preSchedule
protected void postSchedule()
postSchedule
protected final boolean isScheduled()
protected void addPrerequisite(AbstractTask prereq)
prereq
- a AbstractTask
object.protected final void addDependent(AbstractTask dependent)
dependent
- a AbstractTask
object.public final void waitFor() throws InterruptedException, ExecutionException
waitFor
in interface Task
InterruptedException
- if any.ExecutionException
- if any.public final boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException
waitFor
in interface Task
timeout
- a long.unit
- a TimeUnit
object.InterruptedException
- if any.Copyright © 2021. All rights reserved.