WebSphere eXtreme Scale Product Overview >
Transaction processing
WebSphere eXtreme Scale uses transactions as its mechanism for interaction with data.
Sessions and transactions
To interact with data, the thread in the application needs its own Session. When the application wants to use the ObjectGrid on a thread, call one of the ObjectGrid.getSession methods to obtain a thread. With the session, the application can work with data that is stored in the ObjectGrid maps.
When an application uses a Session object, the session must be in the context of a transaction. A transaction begins and commits or begins and rolls back using the begin, commit, and rollback methods on the Session object. Applications can also work in auto-commit mode, in which the Session automatically begins and commits a transaction whenever an operation is performed on the map. Auto-commit mode cannot group multiple operations into a single transaction, so it is the slower option if you are creating a batch of multiple operations into a single transaction. However, for transactions that contain only one operation, auto-commit is the faster option.
Advantages of transactions
By using transactions, you can:
- Roll back changes if an exception occurs or business logic needs to undo state changes.
- Hold and release locks on data to apply multiple changes as an atomic unit at commit time.
- Protect a thread from concurrent changes.
- Implement a life cycle for locks on changes.
- Produce an atomic unit of replication.
- Transactions
Transactions have many advantages for data storage and manipulation. You can use transactions to protect the grid from concurrent changes, to apply multiple changes as a concurrent unit, to replicate data and to implement a life cycle for locks on changes.- Locking strategies
Locking strategies include pessimistic, optimistic and none.To choose a locking strategy, consider issues such as the percentage of each type of operations you have, whether or not you use a loader and so on.