Transaction processing overview

WebSphere® eXtreme Scale uses transactions as its mechanism for interaction with data.

[Java programming language only]

Transaction processing in Java applications

To interact with data, the thread in your 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 session. 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 with 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 runs on the map. Auto-commit mode cannot group multiple operations into a single transaction. Auto-commit mode 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.

When your application is finished with the Session, use the optional Session.close() method to close the session. Closing the Session releases it from the heap and allows subsequent calls to the getSession() method to be reused, improving performance.

[.net programming language only][Version 8.6 and later]

Transaction processing in .NET applications

To interact with data, each thread in your application needs its own transaction object. To use the IGrid interface on a thread in your application, call one of the following methods:
  • IGrid.GetGridMapPessimisticAutoTx
  • IGrid.GetGridMapPessimisticTx
When you call these methods, you obtain an IGridMap object that has a unique transaction object. With the IGridMap object, the application can work with data that is stored in the IGrid maps. When an application uses an IGridMapPessimisticTx object, the data grid operations must be in the context of a transaction. A transaction begins and commits or begins and rolls back the transaction with the begin, commit, and rollback methods on the IGridTransaction object. Applications can also work in auto-commit mode, in which the IGridMapPessimisticAutoTx automatically begins and commits a transaction whenever an operation runs on the map. Auto-commit mode cannot group multiple operations into a single transaction. Auto-commit mode 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.

When your application is finished with the IGridMap instance, dispose the IGridMap object. Disposing the object closes the associated transaction object. As a result, subsequent calls to the GetGridMapPessimisticAutoTx and GetGridMapPessimisticTx methods can reuse an existing, free transaction object, which improves performance.