ObjectStore supports X/Open's transaction demarcation protocol (known as XA).
Distributed Transaction Processing Model
XA is a set of services that is part of the X/Open Distributed Transaction Processing (DTP) model. The model consists of three components: an application, a transaction manager, and a resource manager.
Transaction manager
In the DTP model, transaction demarcation is controlled by a transaction manager (TM). Two-phase commit
Transactions under the control of a transaction manager are made through a two-phase commit process. In the first phase, transactions are prepared to commit; in the second, the transaction is either fully committed or rolled back. Resource manager
An ObjectStore client acts as a resource manager (RM). Resource managers must be registered with the transaction manager. Interface for applications
Applications are written using the transaction manager's API. XA is the interface between the transaction manager and the resource manager and is not visible to application programmers. Transactions in the DTP Model
A global transaction is a metatransaction managed by a transaction manager and possibly involving multiple resource managers. Such transactions have globally unique identifiers generated by the transaction manager. Note that DTP global transactions are distinct from ObjectStore global transactions.
Registering ObjectStore as a Resource Manager
You must register ObjectStore as a resource manager with your transaction manager. The Encina::Server::
The next example uses the OrbixOTS as the transaction manager and describes how to register a resource manager by passing a set of arguments to the Encina::Server::RegisterResource function.
RegisterResource function
:
Intialization Example
The following example illustrates sample initialization code.
extern struct xa_switch_t ObjectStore_xa_switch; // XA_OSTORE_SERVERS should be a space-delimited // list of ObjectStore Server host names. For example, // "host.domain.com host2.domain.com ..." char *openStringP = getenv("XA_OSTORE_SERVERS"); Encina::Server server; // Register the database as a resource manager server.RegisterResource( &ObjectStore_xa_switch, openStringP, "");
If your program tries to start a transaction through the transaction manager when another transaction is already in progress, the transaction manager receives an error.
If your programs attempt to use the regular ObjectStore interface to commit or abort a transaction that was started by a transaction manager, one of the exceptions err_commit_xa or err_abort_xa is generated.
Here is an example of using SERIALIZE_TRPCS_AND_TRANSACTIONS:
server.Listen(Encina::Server::SERIALIZE_TRPCS_AND_TRANSACTIONS);
Recovery is through the transaction manager and occurs during the initialization process for a DTP application.
Updated: 03/31/98 17:04:22