Page 255 -
P. 255

9  The Runtime Environment                                      249
                              predicate. If there are still outstanding subnets for the task, the cycle returns to
                              Step 14. If there are no more outstanding subnets, the Engine completes the par-
                              ent task, produces a token in each of its output conditions, and the cycle returns
                              to Step 4.
                           17. If the completing net is the root net, the case completes.




                           9.5 The Life-Cycle of a Work item


                           A work item is a runtime instance of a task definition, and is created by the Engine
                           at the time determined by the control-flow of the process specification from which
                           a process instance is derived. If the task definition is associated with a decomposi-
                           tion, its work items are created to allow interaction with the external environment
                           (i.e., custom services and applications). If there is no decomposition associated with
                           the task (a so-called placeholder or empty task), it is automatically created and
                           immediately completed internally within the Engine.
                              When a case starts, and when each task within it completes, the Engine analyses
                           the current state of the case to determine which task or tasks it should next make
                           available for execution – or in workflow net terms, it examines the current marking
                           of the net to determine which transitions (tasks) have tokens in each of their input
                           places (conditions), taking into account what type of join decorator (if any) the task
                           has. If the Engine finds there are no tasks available for execution, it means one of
                           two things: either the case has completed normally (if there is/are token(s) in the
                           final output condition) or the case is deadlocked (if not).
                              Between a work item’s creation and its completion, it may move through a num-
                           ber of states; for each state it enters, it is assigned a corresponding status that
                           describes it. There are ten distinct statuses that a work item may be assigned:
                           four live statuses (Enabled, Fired, Executing, and Suspended); five completed status
                           (Complete, ForcedComplete, Canceled, Failed, and Deadlocked); and one “special”
                           status (IsParent). Figure 9.5 shows the work item life-cycle, and how it may progress
                           through the various statuses from creation to completion. Each status is described
                           below.
                              When a work item is created by the Engine, it will be initialized with one of three
                           statuses:
                             Enabled: In most scenarios, a newly created work item will be given Enabled
                              status. In fact, the first-created work item of every task will initially be Enabled.
                              Technically, an enabled work item represents a task that has a token in each of
                              its input places, or if it has a join decorator, a token in each of those input places
                              sufficient to satisfy the join. In practical terms, it means the work item is available
                              to be started or “checked-out” of the Engine
                             Fired: For a previously enabled work item, this status denotes that the work item
                              has been requested to start, but has not yet started, and so represents a brief,
                              transient stage between Enabled and Executing. For a multi-instance task, the
   250   251   252   253   254   255   256   257   258   259   260