Class ActivityTreeStateOverview
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.activity.ActivityTreeStateOverview
-
public class ActivityTreeStateOverview extends Object
-
-
Constructor Summary
Constructors Constructor Description ActivityTreeStateOverview(@NotNull Task rootTask, @NotNull CommonTaskBeans beans)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivityStateOverviewType
getActivityStateTree()
ActivityTreeRealizationStateType
getRealizationState()
void
markTaskStalled(@NotNull String taskOid, long stalledSince, OperationResult result)
Finds all occurrences of the task in "running" activities and marks them as stalled.void
purge(OperationResult result)
void
recordChildren(@NotNull LocalActivityRun<?,?,?> run, List<Activity<?,?>> children, @NotNull OperationResult result)
We need to know about all the children to be able to display the progress correctly.void
recordDistributingActivityRealizationFinish(@NotNull DistributingActivityRun<?,?,?> run, @NotNull ActivityRunResult runResult, @NotNull OperationResult result)
Records the finish of distributing (coordinator) activity realization (NOT run).void
recordDistributingActivityRealizationStart(@NotNull DistributingActivityRun<?,?,?> run, @NotNull OperationResult result)
Records the start of distributing (coordinator) activity realization (NOT run).void
recordLocalRunFinish(@NotNull LocalActivityRun<?,?,?> run, @Nullable ActivityRunResult runResult, @NotNull OperationResult result)
Records the finish of a local activity run.void
recordLocalRunStart(@NotNull LocalActivityRun<?,?,?> run, @NotNull OperationResult result)
Records the start of local activity run in the tree overview.void
recordTaskDead(@NotNull Task task, @NotNull OperationResult result)
Called when a task was found dead.void
updateBucketAndItemProgress(@NotNull LocalActivityRun<?,?,?> run, @NotNull BucketProgressOverviewType bucketProgress, @NotNull OperationResult result)
Updates bucket (and item) progress information in the activity tree.void
updateItemProgressIfTimePassed(@NotNull LocalActivityRun<?,?,?> run, long interval, OperationResult result)
Assumes that the activity run is still in progress.void
updateRealizationState(ActivityTreeRealizationStateType value, OperationResult result)
Updates the realization state (including writing to the repository).
-
-
-
Constructor Detail
-
ActivityTreeStateOverview
public ActivityTreeStateOverview(@NotNull @NotNull Task rootTask, @NotNull @NotNull CommonTaskBeans beans)
-
-
Method Detail
-
recordLocalRunStart
public void recordLocalRunStart(@NotNull @NotNull LocalActivityRun<?,?,?> run, @NotNull @NotNull OperationResult result) throws ActivityRunException
Records the start of local activity run in the tree overview.- Throws:
ActivityRunException
-
recordDistributingActivityRealizationStart
public void recordDistributingActivityRealizationStart(@NotNull @NotNull DistributingActivityRun<?,?,?> run, @NotNull @NotNull OperationResult result) throws ActivityRunException
Records the start of distributing (coordinator) activity realization (NOT run). It sets the fields that are not set by workers in their local runs.- Throws:
ActivityRunException
-
recordChildren
public void recordChildren(@NotNull @NotNull LocalActivityRun<?,?,?> run, List<Activity<?,?>> children, @NotNull @NotNull OperationResult result) throws ActivityRunException
We need to know about all the children to be able to display the progress correctly. So this method updates the tree with the information about children of a composite activity. (Note: We only add records here. We assume that no children are ever deleted.)- Throws:
ActivityRunException
-
recordLocalRunFinish
public void recordLocalRunFinish(@NotNull @NotNull LocalActivityRun<?,?,?> run, @Nullable @Nullable ActivityRunResult runResult, @NotNull @NotNull OperationResult result) throws ActivityRunException
Records the finish of a local activity run. Note that run result can be null only in the case of (very rare) uncaught exception.- Throws:
ActivityRunException
-
recordDistributingActivityRealizationFinish
public void recordDistributingActivityRealizationFinish(@NotNull @NotNull DistributingActivityRun<?,?,?> run, @NotNull @NotNull ActivityRunResult runResult, @NotNull @NotNull OperationResult result) throws ActivityRunException
Records the finish of distributing (coordinator) activity realization (NOT run). It sets the fields that are not set by workers in their local runs.- Throws:
ActivityRunException
-
recordTaskDead
public void recordTaskDead(@NotNull @NotNull Task task, @NotNull @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException
Called when a task was found dead. Updates the execution state (in the future we plan also to update the progress).
-
updateBucketAndItemProgress
public void updateBucketAndItemProgress(@NotNull @NotNull LocalActivityRun<?,?,?> run, @NotNull @NotNull BucketProgressOverviewType bucketProgress, @NotNull @NotNull OperationResult result) throws ActivityRunException
Updates bucket (and item) progress information in the activity tree. Also clears the "stalled since" flag. Note that there can be a race condition when updating buckets. If an update that was generated earlier (containing smaller # of completed buckets) is applied after an update generated later (larger # of completed buckets), incorrect results may be stored in the overview. Therefore we use a hack withisBefore(BucketProgressOverviewType, BucketProgressOverviewType)
method.- Throws:
ActivityRunException
-
updateItemProgressIfTimePassed
public void updateItemProgressIfTimePassed(@NotNull @NotNull LocalActivityRun<?,?,?> run, long interval, OperationResult result) throws SchemaException, ObjectNotFoundException
Assumes that the activity run is still in progress. (I.e. also clear the "stalled since" flag.)
-
markTaskStalled
public void markTaskStalled(@NotNull @NotNull String taskOid, long stalledSince, OperationResult result) throws ObjectNotFoundException, SchemaException
Finds all occurrences of the task in "running" activities and marks them as stalled.
-
getRealizationState
public ActivityTreeRealizationStateType getRealizationState()
-
updateRealizationState
public void updateRealizationState(ActivityTreeRealizationStateType value, OperationResult result) throws ActivityRunException
Updates the realization state (including writing to the repository).- Throws:
ActivityRunException
-
getActivityStateTree
public ActivityStateOverviewType getActivityStateTree()
-
purge
public void purge(OperationResult result) throws ActivityRunException
- Throws:
ActivityRunException
-
-