mirror of https://github.com/apache/druid.git
TaskGroup: Add javadocs
This commit is contained in:
parent
65576cbade
commit
86ec3a372e
|
@ -74,10 +74,18 @@ public class TaskGroup
|
||||||
return new ImmediateCommitStyle();
|
return new ImmediateCommitStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns number of tasks in this group.
|
||||||
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
return taskMap.size();
|
return taskMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a task to this group.
|
||||||
|
* @param task task to add
|
||||||
|
* @return true iff this group did not already contain the task
|
||||||
|
*/
|
||||||
public boolean add(final Task task) {
|
public boolean add(final Task task) {
|
||||||
Preconditions.checkArgument(
|
Preconditions.checkArgument(
|
||||||
task.getGroupId().equals(groupId),
|
task.getGroupId().equals(groupId),
|
||||||
|
@ -86,7 +94,6 @@ public class TaskGroup
|
||||||
groupId
|
groupId
|
||||||
);
|
);
|
||||||
|
|
||||||
// Act sort of like a Set
|
|
||||||
if(taskMap.containsKey(task.getId())) {
|
if(taskMap.containsKey(task.getId())) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,10 +102,18 @@ public class TaskGroup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this group contains a particular task.
|
||||||
|
*/
|
||||||
public boolean contains(final String taskId) {
|
public boolean contains(final String taskId) {
|
||||||
return taskMap.containsKey(taskId);
|
return taskMap.containsKey(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a task from this group.
|
||||||
|
* @param taskId task ID to remove
|
||||||
|
* @return the removed task, or null if the task was not in this group
|
||||||
|
*/
|
||||||
public Task remove(final String taskId)
|
public Task remove(final String taskId)
|
||||||
{
|
{
|
||||||
return taskMap.remove(taskId);
|
return taskMap.remove(taskId);
|
||||||
|
|
Loading…
Reference in New Issue