java.lang.Object
org.elasticsearch.tasks.CancellableTasksTracker<T>
Tracks items that are associated with cancellable tasks, supporting efficient lookup by task ID and by parent task ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget
(long id) Get the item that corresponds with the given task, ornull
if there is no such item.getByParent
(TaskId parentTaskId) Return a collection of all the tracked items with a given parent, which will include at least every item for whichput(org.elasticsearch.tasks.Task, T)
completed, butremove(org.elasticsearch.tasks.Task)
hasn't started.void
Add an item for the given task.Remove (and return) the item that corresponds with the given task.values()
Return a collection of all the tracked items.
-
Constructor Details
-
CancellableTasksTracker
-
-
Method Details
-
put
Add an item for the given task. Should only be called once for each task, anditem
must be unique per task too. -
get
Get the item that corresponds with the given task, ornull
if there is no such item. -
remove
Remove (and return) the item that corresponds with the given task. Returnnull
if not present. Safe to call multiple times for each task. However,getByParent(org.elasticsearch.tasks.TaskId)
may return this task even after a call to this method completes, if the removal is actually being completed by a concurrent call that's still ongoing. -
values
Return a collection of all the tracked items. May be large. In the presence of concurrent calls toput(org.elasticsearch.tasks.Task, T)
andremove(org.elasticsearch.tasks.Task)
it behaves similarly toConcurrentHashMap.values()
. -
getByParent
Return a collection of all the tracked items with a given parent, which will include at least every item for whichput(org.elasticsearch.tasks.Task, T)
completed, butremove(org.elasticsearch.tasks.Task)
hasn't started. May include some additional items for which all the calls toremove(org.elasticsearch.tasks.Task)
that started before this method was called have not completed.
-