@InterfaceAudience.Private public class TaskGroup extends MonitoredTaskImpl
TaskGroup
can be seen as a big MonitoredTask
, which contains a list of sub
monitored tasks. The monitored tasks in the group are still be managed by the
TaskMonitor
, but whether to clear/expire the monitored tasks in a task group is optional.
Since the monitored task already has journals, which mark the phases in a task, we still also
need a task group to monitor a big task/process because the journals in a task is serial but the
tasks in the task group can be parallel, then we have more flexible ability to monitor the
process. Grouping the tasks is not strictly necessary but it is cleaner for presentation to
operators. We might want to display the tasks in a group in a list view where each task can be
collapsed (probably by default) or expanded.MonitoredTask.State, MonitoredTask.StatusJournalEntry
Modifier and Type | Field and Description |
---|---|
private MonitoredTask |
delegate
Used to track this task group in
TaskMonitor |
private boolean |
ignoreSubTasksInTaskMonitor
Whether to ignore to track(e.g.
|
private static org.slf4j.Logger |
LOG |
private ConcurrentLinkedDeque<MonitoredTask> |
tasks
Sub-tasks in the group
|
state
Constructor and Description |
---|
TaskGroup(boolean ignoreSubTasksInTaskMonitor,
String description) |
Modifier and Type | Method and Description |
---|---|
void |
abort(String msg) |
MonitoredTask |
addTask(String description) |
MonitoredTask |
addTask(String description,
boolean withCompleteLast)
Add a new task to the group, and before that might complete the last task in the group
|
void |
cleanup()
Explicitly mark this status as able to be cleaned up, even though it might not be complete.
|
Collection<MonitoredTask> |
getTasks() |
void |
markComplete(String msg) |
clone, expireNow, getCompletionTimestamp, getDescription, getStartTime, getState, getStateTime, getStatus, getStatusJournal, getStatusTime, getWarnTime, pause, prettyPrintJournal, resume, setDescription, setState, setStatus, setWarnTime, toJSON, toMap, toString
private static final org.slf4j.Logger LOG
private final ConcurrentLinkedDeque<MonitoredTask> tasks
private boolean ignoreSubTasksInTaskMonitor
TaskMonitor
private final MonitoredTask delegate
TaskMonitor
public MonitoredTask addTask(String description)
public MonitoredTask addTask(String description, boolean withCompleteLast)
description
- the description of the new taskwithCompleteLast
- whether to complete the last task in the grouppublic Collection<MonitoredTask> getTasks()
public void abort(String msg)
abort
in interface MonitoredTask
abort
in class MonitoredTaskImpl
public void markComplete(String msg)
markComplete
in interface MonitoredTask
markComplete
in class MonitoredTaskImpl
public void cleanup()
MonitoredTask
cleanup
in interface MonitoredTask
cleanup
in class MonitoredTaskImpl
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.