When you use
the WebSphereTransactionCallback plug-in, enterprise applications
that are running in a WebSphere® Application
Server environment can manage ObjectGrid transactions. This plug-in
is deprecated. Use the WebSphere eXtreme Scale resource
adapter instead.
The WebSphereTransactionCallback interface
has been replaced by the WebSphere eXtreme Scale resource
adapter, which enables Java Transaction API (JTA) transaction management.
You can install this resource adapter on WebSphere Application Server or other Java
Platform, Enterprise Edition (Java EE) application servers. The WebSphereTransactionCallback plug-in
is not an enlisted JTA API, and therefore, is not designed to roll
back the JTA transaction if the commit fails.
When you are using an ObjectGrid session within a method that is configured to use container-managed transactions, the enterprise container automatically begins, commits or rolls back the ObjectGrid transaction. When you are using Java™ Transaction API (JTA) UserTransaction objects, the ObjectGrid transaction is managed by the UserTransaction object automatically.
For a detailed discussion of the implementation of this plug-in, see External transaction managers.
You can enable the WebSphereTransactionCallback into the ObjectGrid configuration with programmatic configuration or XML configuration. The following code snippet uses the application to create the WebSphereTransactionCallback object and add it to an ObjectGrid:
ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid myGrid = objectGridManager.createObjectGrid("myGrid", false);
WebSphereTransactionCallback wsTxCallback= new WebSphereTransactionCallback ();
myGrid.setTransactionCallback(wsTxCallback);
The following XML configuration creates the WebSphereTransactionCallback object and adds it to an ObjectGrid. The following text must be in the myGrid.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="myGrid">
<bean id="TransactionCallback" className=
"com.ibm.websphere.objectgrid.plugins.builtins.WebSphereTransactionCallback" />
</objectGrid>
</objectGrids>
</objectGridConfig>