WebSphere eXtreme Scale Programming Guide > System APIs and plug-ins



WebSphereTransactionCallback plug-in


When you use the WebSphereTransactionCallback plug-in, enterprise applications that are running in a WebSphere Application Server environment can manage ObjectGrid transactions.

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

The ObjectGrid does not support 2-phase, XA transactions. This plug-in does not enlist the ObjectGrid transaction with the transaction manager. Therefore, if the ObjectGrid fails to commit, any other resources that are managed by the XA transaction do not roll back.


Enable the WebSphereTransactionCallback plug-in

You can enable the WebSphereTransactionCallback into the ObjectGrid configuration with programmatic configuration or XML configuration.


XML configuration approach to plug in the WebSphereTransactionCallback object

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>


Programmatically plug in the WebSphereTransactionCallback object

The following code snippet creates the WebSphereTransactionCallback object and adds it to an ObjectGrid:

ObjectGridManager objectGridManager = ObjectGridManagerFactory.getObjectGridManager();
ObjectGrid myGrid = objectGridManager.createObjectGrid("myGrid", false);
WebSphereTransactionCallback wsTxCallback= new WebSphereTransactionCallback ();
myGrid.setTransactionCallback(wsTxCallback);



Parent topic

System APIs and plug-ins


+

Search Tips   |   Advanced Search