Browse Prior Art Database

Automatic Compensation of Actions in a State Machine

IP.com Disclosure Number: IPCOM000016255D
Original Publication Date: 2002-Sep-16
Included in the Prior Art Database: 2003-Jun-21
Document File: 2 page(s) / 53K

Publishing Venue

IBM

Abstract

Summary Disclosed is a method for the automatic compensation of partially processed events in a State Machine which allows the underlying mechanism for the compensation to be hidden from the application developer. Background Information A State Machine is defined as follows in the OMG UML V1.4 Specification: '...a specification that describes all possible behaviors of some dynamic model element. Behavior is modelled as a traversal of a graph of state nodes interconnected by one or more joined transition arcs that are triggered by the dispatching of a series of event instances. During this traversal, the state machine executes a series of actions associated with various elements of the state machine.' The passage between 2 state nodes in a state machine as a result of a dispatched event is known (in UML terminology) as the run-to-completion step . A new event will not be dispatched and processed by the state machine until the previous run-to-completion step has completed. A state machine must be in a well defined state at the end of a run-to-completion step. The problem of undoing work done in a failed run-to-completion step of a state machine has traditionally been addressed by the use of transaction scoping . A typical way of doing this would be to scope each run-to-completion step with a transaction and to ensure that each action in the run-to-completion step registers transactional resources with the enclosing transaction. Compensation is a process used for 'reversing' successfully completed work in the case of some sort of failure condition within the same compensation scope. Each atomic piece of 'compensatable' work and its associated compensating 'reverse' action is defined by a Compensation Pair . Thus, a compensation pair is a tuple consisting of a primary action and a secondary 'undo' action. Note that the secondary action need not be the exact reverse of the primary action it just needs to compensate the work done. For example, if a primary action to ship an order to a customer may have a corresponding secondary action to send a letter to request that the order be returned. A number of compensation pairs may be wrapped (scoped) by a Compensation Sphere . Primary actions of the compensation pairs in a compensation sphere are processed until each of them has been processed. If all the primary actions enclosed by the compensation sphere are processed successfully, the compensation sphere has successfully completed and no further processing occurs relating to that compensation sphere (unless, possibly, if that compensation sphere is nested). If an action fails during the processing of the compensation sphere, the compensation sphere undoes all of the work done so far within its scope. In practice, this means that each of the secondary actions relating to the primary actions that were successfully run are invoked in reverse order. Each secondary action will be run in the same (or a similar) environment to its primary counterpart. Details Each run-to-completion step of a State Machine includes compensation logic to ensure that the processing of each event by the State Machine is automatically 1

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 51% of the total text.

Page 1 of 2

Automatic Compensation of Actions in a State Machine

Summary Disclosed is a method for the automatic compensation of partially processed events in a State Machine which allows the underlying mechanism for the compensation to be hidden from the application developer. Background Information

A State Machine is defined as follows in the OMG UML V1.4 Specification: '...a specification that describes all possible behaviors of some dynamic model element. Behavior is modelled as a traversal of a graph of state nodes interconnected by one or more joined transition arcs that are triggered by the dispatching of a series of event instances. During this traversal, the state machine executes a series of actions associated with various elements of the state machine.' The passage between 2 state nodes in a state machine as a result of a dispatched event is known (in UML terminology) as the run-to-completion step. A new event will not be dispatched and processed by the state machine until the previous run-to-completion step has completed. A state machine must be in a well defined state at the end of a run-to-completion step. The problem of undoing work done in a failed run-to-completion step of a state machine has traditionally been addressed by the use of transaction scoping. A typical way of doing this would be to scope each run-to-completion step with a transaction and to ensure that each action in the run-to-completion step registers transactional resources with the enclosing transaction. Compensation is a process used for 'reversing' successfully completed work in the case of some sort of failure condition within the same compensation scope. Each atomic piece of 'compensatable' work and its associated compensating 'reverse' action is defined by a Compensation Pair. Thus, a compensation pair is a tuple consisting of a primary action and a secondary 'undo' action. Note that the secondary action need not be the exact reverse of the primary action - it just needs to compensate the work done. For example, if a primary action to ship an order to a customer may have a corresponding secondary action to send a letter to request that the order be returned. A number of compensation pairs may be wrapped (scoped) by a Compensation Sphere. Primary actions of the compensation pairs in a compensation sphere are processed until each of them has been processed. If all the primary actions enclosed by the compensation sphere are processed successfully, the compensation sphere has successfully completed and no further processing occurs relating to that compensation sphere (unless, possibly, if that compensation sphere is nested). If an action fails during the processing of the compensation sphere, the compensation sphere undoes all of the work done so far within its scope. In practice, this means that each of the secondary actions relating to the primary actions that were successfully run are invoked in reverse order. Each secondary action will be run in the same...