public abstract class Task extends Object
Constructor and Description |
---|
Task(DefaultTaskCoordinator coordinator,
ContainerTask<?> parent)
Constructor for Task.
|
Modifier and Type | Method and Description |
---|---|
void |
addDependent(Task dependent)
Adds dependent as a dependent of this task.
|
void |
addPrerequisite(Task prereq)
Add's 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.
|
DefaultTaskCoordinator |
getCoordinator()
getCoordinator
|
TaskMonitor |
getMonitor()
getMonitor
|
boolean |
isFinished()
This task's run method has completed
|
boolean |
isScheduled()
This task has be sent to the TaskCoordinator to be run
|
protected void |
markTaskAsCompleted()
markTaskAsCompleted
|
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
|
protected void |
submitRunnable(Runnable runnable,
String preferredExecutor)
submitRunnable
|
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 Task(DefaultTaskCoordinator coordinator, ContainerTask<?> parent)
Constructor for Task.
coordinator
- a DefaultTaskCoordinator
object.parent
- a ContainerTask
object.public DefaultTaskCoordinator getCoordinator()
getCoordinator
DefaultTaskCoordinator
object.public TaskMonitor getMonitor()
getMonitor
TaskMonitor
object.protected void doSubmit()
protected void completeSubmit()
public void schedule()
protected void preSchedule()
preSchedule
protected void postSchedule()
postSchedule
public boolean isFinished()
public boolean isScheduled()
public void addPrerequisite(Task prereq)
prereq
- a Task
object.public void addDependent(Task dependent)
dependent
- a Task
object.public void waitFor() throws InterruptedException, ExecutionException
InterruptedException
- if any.ExecutionException
- if any.public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException
timeout
- a long.unit
- a TimeUnit
object.InterruptedException
- if any.protected void markTaskAsCompleted()
markTaskAsCompleted
protected void submitRunnable(Runnable runnable, String preferredExecutor)
submitRunnable
Copyright © 2017. All rights reserved.