Class ActivityTreeStateOverview
java.lang.Object
com.evolveum.midpoint.repo.common.activity.ActivityTreeStateOverview
Represents the activity tree state overview that is stored in the root task.
This class does _not_ hold the state itself. Instead, it contains methods that update the state in the task.
See e.g.
recordLocalRunStart(LocalActivityRun, OperationResult)
and its brethren.-
Constructor Summary
ConstructorDescriptionActivityTreeStateOverview
(@NotNull Task rootTask, @NotNull CommonTaskBeans beans) -
Method Summary
Modifier and TypeMethodDescriptionvoid
markTaskStalled
(@NotNull String taskOid, long stalledSince, OperationResult result) Finds all occurrences of the task in "running" activities and marks them as stalled.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
recordDistributedActivityRealizationFinish
(@NotNull DistributingActivityRun<?, ?, ?> run, @NotNull ActivityRunResult runResult, @NotNull OperationResult result) Records the finish of distributed activity realization (NOT run).void
recordDistributedActivityRealizationStart
(@NotNull DistributingActivityRun<?, ?, ?> run, @NotNull OperationResult result) Records the start of distributed 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.
-
Constructor Details
-
ActivityTreeStateOverview
public ActivityTreeStateOverview(@NotNull @NotNull Task rootTask, @NotNull @NotNull CommonTaskBeans beans)
-
-
Method Details
-
recordLocalRunStart
public void recordLocalRunStart(@NotNull @NotNull LocalActivityRun<?, ?, throws ActivityRunException?> run, @NotNull @NotNull OperationResult result) Records the start of local activity run in the tree overview.- Throws:
ActivityRunException
-
recordDistributedActivityRealizationStart
public void recordDistributedActivityRealizationStart(@NotNull @NotNull DistributingActivityRun<?, ?, throws ActivityRunException?> run, @NotNull @NotNull OperationResult result) Records the start of distributed 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<?, ?, throws ActivityRunException?> run, List<Activity<?, ?>> children, @NotNull @NotNull OperationResult result) 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<?, ?, throws ActivityRunException?> run, @Nullable @Nullable ActivityRunResult runResult, @NotNull @NotNull OperationResult result) 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
-
recordDistributedActivityRealizationFinish
public void recordDistributedActivityRealizationFinish(@NotNull @NotNull DistributingActivityRun<?, ?, throws ActivityRunException?> run, @NotNull @NotNull ActivityRunResult runResult, @NotNull @NotNull OperationResult result) Records the finish of distributed 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<?, ?, throws ActivityRunException?> run, @NotNull @NotNull BucketProgressOverviewType bucketProgress, @NotNull @NotNull OperationResult result) 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<?, ?, throws SchemaException, ObjectNotFoundException?> run, long interval, OperationResult result) 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
-