Class AbstractTaskExecution<TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>>
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.task.AbstractTaskExecution<TH,TE>
-
- Direct Known Subclasses:
AbstractScannerTaskExecution
,AsyncUpdateTaskHandler.TaskExecution
,ImportFromResourceTaskExecution
,LiveSyncTaskHandler.TaskExecution
,ObjectIntegrityCheckTaskHandler.TaskExecution
,ReconciliationTaskExecution
,ShadowIntegrityCheckTaskHandler.TaskExecution
,SimpleIterativeTaskHandler.TaskExecution
public abstract class AbstractTaskExecution<TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>> extends Object
Holds data common for the whole task execution, i.e. data that are shared among all the parts. *TODO: thread safety ... hopefully, currentTaskPartExecution is the only field accessed by external threads* *TODO: Generalize this class a bit. Consider moving to the task module.*
-
-
Field Summary
Fields Modifier and Type Field Description RunningTask
localCoordinatorTask
Worker task scheduled by Quartz.TaskPartitionDefinitionType
partDefinition
Definition of task part currently processed.TH
taskHandler
The task handler.protected WorkBucketType
workBucket
Bucket currently processed.
-
Constructor Summary
Constructors Constructor Description AbstractTaskExecution(TH taskHandler, RunningTask localCoordinatorTask, WorkBucketType workBucket, TaskPartitionDefinitionType partDefinition, TaskWorkBucketProcessingResult previousRunResult)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<? extends AbstractIterativeTaskPartExecution<?,?,?,?,?>>
createPartExecutions()
Creates executions for individual task parts.protected void
finish(OperationResult opResult, Throwable t)
Called right before the execution stops, even in the case of exceptions.@NotNull TaskWorkBucketProcessingResult
getCurrentRunResult()
@NotNull ErrorState
getErrorState()
PrismContext
getPrismContext()
@NotNull String
getRootTaskOid()
protected <C extends Containerable>
CgetTaskContainerRealValue(ItemName containerName)
protected <X> X
getTaskPropertyRealValue(ItemName propertyName)
Long
heartbeat()
TODO reconsider this methodprotected void
initialize(OperationResult opResult)
Called right on the start of the task execution, even before parts are created.boolean
isInternallyMultipart()
TaskWorkBucketProcessingResult
run()
Main execution method.void
setPermanentErrorEncountered(@NotNull Throwable reason)
-
-
-
Field Detail
-
taskHandler
@NotNull public final TH extends AbstractTaskHandler<TH,TE> taskHandler
The task handler. Used mainly to access Spring beans.
-
localCoordinatorTask
public final RunningTask localCoordinatorTask
Worker task scheduled by Quartz. Can have worker threads.
-
workBucket
protected final WorkBucketType workBucket
Bucket currently processed. Provided by task manager.
-
partDefinition
public final TaskPartitionDefinitionType partDefinition
Definition of task part currently processed. Provided by task manager.
-
-
Constructor Detail
-
AbstractTaskExecution
public AbstractTaskExecution(@NotNull TH taskHandler, RunningTask localCoordinatorTask, WorkBucketType workBucket, TaskPartitionDefinitionType partDefinition, TaskWorkBucketProcessingResult previousRunResult)
-
-
Method Detail
-
run
public TaskWorkBucketProcessingResult run() throws SchemaException, TaskException, CommunicationException, ConfigurationException, ObjectNotFoundException, SecurityViolationException, ExpressionEvaluationException, ObjectAlreadyExistsException, PolicyViolationException, PreconditionViolationException
Main execution method. Iterates through all the part executions, running each of them until finished or until the execution stops. Note that the final handling of exceptions is NOT done here, but within the task handler.
-
createPartExecutions
public List<? extends AbstractIterativeTaskPartExecution<?,?,?,?,?>> createPartExecutions()
Creates executions for individual task parts. Overridden for handlers that have more than one part and therefore cannot rely on class annotations.
-
initialize
protected void initialize(OperationResult opResult) throws TaskException, CommunicationException, SchemaException, ConfigurationException, ObjectNotFoundException, SecurityViolationException, ExpressionEvaluationException
Called right on the start of the task execution, even before parts are created. Used for things like ResourceType object resolution, and so on.
-
finish
protected void finish(OperationResult opResult, Throwable t) throws TaskException, SchemaException
Called right before the execution stops, even in the case of exceptions.- Throws:
TaskException
SchemaException
-
getTaskPropertyRealValue
protected <X> X getTaskPropertyRealValue(ItemName propertyName)
-
getTaskContainerRealValue
protected <C extends Containerable> C getTaskContainerRealValue(ItemName containerName)
-
getPrismContext
public PrismContext getPrismContext()
-
getCurrentRunResult
@NotNull public @NotNull TaskWorkBucketProcessingResult getCurrentRunResult()
-
heartbeat
public Long heartbeat()
TODO reconsider this method
-
setPermanentErrorEncountered
public void setPermanentErrorEncountered(@NotNull @NotNull Throwable reason)
-
getErrorState
@NotNull public @NotNull ErrorState getErrorState()
-
getRootTaskOid
@NotNull public @NotNull String getRootTaskOid()
-
isInternallyMultipart
public boolean isInternallyMultipart()
-
-