Server Smalltalk Guide

Transactional code

While transactions are explicitly available, you typically manipulate them implicitly through transactional code. Transactional code is code executed in the context of some transaction. Regions of code at different levels of granularity can be transactional:

Block
The code within the scope of the block is transactional.
Method
The entire body of the method is transactional.
Object
All public methods for the marked object are transactional.
Class
All public methods of the indicated class are transactional for all instances of the class and its subclasses.

Note that SST's definition of the term transactional object differs from that of CORBA's OTS. In CORBA a transactional object is simply one which inherits from TransactionalObject and so ensures that any existing transaction context is passed along when the object is invoked. SST's transactional objects are objects whose methods are transactional and so manage the executing transaction context according to the code's transaction mode.

Whenever execution enters a section of transactional code, SST ensures that the current state of the transaction system conforms to the transaction mode specified for the code segment. For example, if a block of code is marked as soft transactional then on entering the code, SST automatically creates a new transaction if there is no current transaction. If there is a current transaction then it is used as the context for the transactional code.

SST exposes the following transaction modes:

Check
Fail if there is no current transaction.

Ensure
If a current transaction is available then it is used as the context for the transactional code. Otherwise, create a new top-level transaction.

TopLevel
Create a new top-level transaction.

Default
Use the default mode specified by the current execution environment. First check any existing Transactor (see below), then consult the relevant transactions and transaction services.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]