ITransactionManager Interface Reference

Inherited by JiniTransactionManager, and LocalTransactionManager.

List of all members.


Detailed Description

Provides an interface for a Transaction Manager.

The Transaction Manager can be used to create a new transaction.

There are 2 types of Transaction Managers:

When working with only a single space instance, the Local Transaction Manager should be used. When working with a clustered topology, and performing operations that span over several cluster members, the Distributed Transaction Manager should be used.
Note, this can be avoided when working with the SBA model, where each cluster member works only with its local Space instance.

Respectively, the methods to retrieve a Transaction Manager are:

Sample usage:

Here is an example of creating and using a local transaction:


 SpaceFinder spaceFinder;
 SpaceProxyPtr SpaceProxy = spaceFinder.find("jini://lookup-host/container-name/space-name");
 ITransactionManagerPtr localTxnMgr = SpaceProxy->getLocalTransactionManager();
 TransactionPtr txn = localTxnMgr->create();
 // ...
 // Use the transaction to perform space operations
 // ...
 txn->commit();
 

Here is an example of creating and using a distributed transaction based on Jini Mahalo (note the use of Config object):


 #define LOOKUP_GROUPS "MY-LOOKUP-GROUPS"
 SpaceFinder spaceFinder;
 SpaceProxyPtr SpaceProxy = spaceFinder.find("jini://lookup-host/container-name/space-name");
 IConfigPtr config(new JiniConfig("", "", LOOKUP_GROUPS));
 ITransactionManagerPtr distTxnMgr = SpaceProxy->getDistributedTransactionManager(config);
 TransactionPtr txn = distTxnMgr->create();
 // ...
 // Use the transaction to perform space operations
 // ...
 txn->commit();
 

Author:
Irit Rosdeutscher
See also:
Transaction, SpaceProxy, IConfig, JiniConfig

Public Member Functions

virtual TransactionPtr create (long long leaseTime=60000)=0
 Creates a new Transaction.

Member Function Documentation

virtual TransactionPtr ITransactionManager::create ( long long  leaseTime = 60000  )  [pure virtual]

Creates a new Transaction.

The type of the new Transaction is determined by the type of the Transaction Manager (Local vs. Distributed)

Parameters:
leaseTime - The time period in milliseconds until the Transaction is discarded. Default is 60 seconds.
Returns:
New Transaction
Exceptions:
RemoteException - if a communication error occurs
LeaseDeniedException - if the requested leaseTime is denied


Generated on Thu Jul 22 08:11:54 2010 for GigaSpaces XAP 10.1 C++ by  doxygen 1.5.3