Monitoring and Managing Two-Phase Commit
Chapter 6 Managing Process Execution 201
Because of this two-phase commit capability, an iIS engine transaction and an
application transaction can be combined into a higher level distributed transaction.
The constituent transactions are placed in a PREPARE phase before either can
commit. If either of the constituent transactions cannot be placed in a PREPARE
phase, then the other is rolled back to its original state. In other words, the
distributed transaction only commits if both constituent transactions commit,
guaranteeing that application state and process state are synchronized.
The iIS two-phase commit protocol also facilitates synchronization between
different activitiesor sessionsin a given process instance. For example, if Client
Application A (session A) has already prepared an AbortProcess for the process
instance, and Client Application B (session B) tries to complete or abort an activity
belonging to that process instance, an exception is raised on session B indicating
that session A is going to abort the same process instance.
The iIS two-phase commit protocol makes it possible to include the following iIS
engine operations in a transactional context:
creating a process
aborting a process
starting an activity
completing an activity
aborting an activity
When included in a transactional context, these operations are automatically
placed in a PREPARE phase before being explicitly committed or rolled back. For
example, any StartActivity or CompleteActivity operation would be automatically
placed in a PREPARE phase.
By being placed in a transactional context, these iIS transactions can be
synchronized, as described above, with application update transactions. The client
application simply prepares any application (database update) operations it needs
to make. If the application transaction can be successfully placed in a PREPARE
phase, then the client application can commit both the application transaction and
the iIS engine transaction. If the application transaction cannot be successfully
placed in a PREPARE phase, then the client application should roll back the iIS
engine transaction.
All iIS objects associated with a prepared transaction are unavailable for further
operations until the client application explicitly commits or rolls back the
transaction.