Class ActivityTreeStateOverview
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.activity.ActivityTreeStateOverview
-
public class ActivityTreeStateOverview extends Object
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
Constructors Constructor Description ActivityTreeStateOverview(@NotNull Task rootTask, @NotNull CommonTaskBeans beans)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
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 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
-
recordDistributedActivityRealizationStart
public void recordDistributedActivityRealizationStart(@NotNull @NotNull DistributingActivityRun<?,?,?> run, @NotNull @NotNull OperationResult result) throws ActivityRunException
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<?,?,?> 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
-
recordDistributedActivityRealizationFinish
public void recordDistributedActivityRealizationFinish(@NotNull @NotNull DistributingActivityRun<?,?,?> run, @NotNull @NotNull ActivityRunResult runResult, @NotNull @NotNull OperationResult result) throws ActivityRunException
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<?,?,?> 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()
-
-