Package org.elasticsearch.persistent
Class AllocatedPersistentTask
org.elasticsearch.tasks.Task
org.elasticsearch.tasks.CancellableTask
org.elasticsearch.persistent.AllocatedPersistentTask
Represents a executor node operation that corresponds to a persistent task
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class org.elasticsearch.tasks.Task
X_OPAQUE_ID
-
Constructor Summary
ConstructorDescriptionAllocatedPersistentTask(long id, type, action, description, TaskId parentTask, <,> headers)
-
Method Summary
Modifier and TypeMethodDescriptionlong
Build a status for this task or null if this task doesn't have status.protected void
init(PersistentTasksService persistentTasksService, TaskManager taskManager, persistentTaskId, long allocationId)
protected boolean
void
void
e)
void
updatePersistentTaskState(PersistentTaskState state, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener)
Updates the persistent state for the corresponding persistent task.void
<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, org.elasticsearch.core.TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener)
Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.Methods inherited from class org.elasticsearch.tasks.CancellableTask
getReasonCancelled, isCancelled, onCancelled, shouldCancelChildrenOnCancellation
Methods inherited from class org.elasticsearch.tasks.Task
getAction, getDescription, getHeader, getId, getParentTaskId, getStartTime, getStartTimeNanos, getType, headers, result, result, taskInfo, taskInfo
Methods inherited from class java.lang.
, , , , , , , , , ,
-
Constructor Details
-
AllocatedPersistentTask
public AllocatedPersistentTask(long id, type, action, description, TaskId parentTask, <,> headers)
-
-
Method Details
-
getStatus
Description copied from class:Task
Build a status for this task or null if this task doesn't have status. Since most tasks don't have status this defaults to returning null. While this can never perform IO it might be a costly operation, requiring collating lists of results, etc. So only use it if you need the value. -
updatePersistentTaskState
public void updatePersistentTaskState(PersistentTaskState state, ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener)Updates the persistent state for the corresponding persistent task.This doesn't affect the status of this allocated task.
-
getPersistentTaskId
public getPersistentTaskId() -
init
protected void init(PersistentTasksService persistentTasksService, TaskManager taskManager, persistentTaskId, long allocationId) -
getFailure
public getFailure() -
getAllocationId
public long getAllocationId() -
waitForPersistentTask
public void waitForPersistentTask(<PersistentTasksCustomMetadata.PersistentTask<?>> predicate, @Nullable org.elasticsearch.core.TimeValue timeout, PersistentTasksService.WaitForPersistentTaskListener<?> listener)Waits for a given persistent task to comply with a given predicate, then call back the listener accordingly.- Parameters:
predicate
- the persistent task predicate to evaluatetimeout
- a timeout for waitinglistener
- the callback listener
-
isCompleted
protected final boolean isCompleted() -
markAsCompleted
public void markAsCompleted() -
markAsFailed
public void markAsFailed( e)
-