The tx library enables direct access to pds transactions. At the bottom of this page there are some important notices about the transaction manager. You should always respect them to develop stable code.
You can use maven to download and install this module. Add the repository linked in this website's menu to find the modules. You will need one of the following modules depending on the version you are using:
Maven will manage dependencies. if you are installing manually you will need the following module jar:
To run and use this module add the jars to your bootstrap jar. View the installation notes of the start project .
You will need no additional configuration.
All information you need is contained in the java doc of interface ITransactionManager . This interface will be installed as a regular pds manager (related service class is named ITransactionService).
We assume that you are already familiar using the pds transactions. However they will be started and commited in the background. Many services use them (f.e. the pds DataService).
Let us assume that you are running your own java thread. You can use the transaction service to start and commit transactions manually. Look at the following code:
final ITransactionManager txManager = AppContext.getManager(ITransactionManager.class); ITransaction tx = txManager.begin(); // TODO do something, f.e. access the data storage tx.commit(); // TODO do some other thing that does not need transactions tx.begin(); // TODO do the third thing tx.commit();
This code fragment starts two independent transactions. After commiting the first transaction there may be some code that does not need transactions at all.