[Java programming language only]

Developing applications to write to multi-partition transactions for WebSphere eXtreme Scale in a stand-alone environment

[Version 8.6 and later] You can write an application for a distributed data grid with multiple partitions in your stand-alone WebSphere® eXtreme Scale environment.

Before you begin

Enable the eXtremeIO protocol. For more information, see Configuring IBM eXtremeIO (XIO).
Restriction: You should note the following restrictions before developing applications to write to multi-partition transactions.
  • You cannot use multi-master replication with transactions that write to multiple partitions.
  • You cannot use multi-partitions in a WebSphere eXtreme Scale Client in a .NET environment.
  • BackingMaps that are configured with a Loader plug-in can read but cannot write to the map in a multi-partition transaction.
  • BackingMaps that are using locking strategy as NONE cannot participate in multi-partition transactions.

About this task

Use the set TxCommitProtocol Session API to enable multi-partition transaction support for WebSphere eXtreme Scale in a stand-alone environment. The new API provides the following two options: You can also configure multi-transaction support for WebSphere eXtreme Scale within WebSphere Application Server. For more information, see Developing eXtreme Scale client components to use transactions.

Procedure

  1. Connect to the data grid. For more information, see Connecting to distributed ObjectGrid instances programmatically.
  2. Obtain an data grid session instance with the ObjectGrid.getSession method. For more information, see Using Sessions to access data in the grid.
  3. Enable a two-phase commit protocol by setting the following code snippet: session.setTxCommitProtocol(Session.TxCommitProtocol.TWOPHASE); session.begin(); The following code snippet illustrates how to create, retrieve, update, and delete operations in a grid with a two-phase commit protocol:
    Session session = og.getSession();
    Objectmap map1 = session.getMap("Map1");
    Objectmap map2 = session.getMap("Map2");
    Objectmap map3 = session.getMap("Map3");
    session.setTxCommitProtocol(Session.TxCommitProtocol.TWOPHASE);
    session.begin();
    map1.insert("randKey345", "HelloMap1");
    map2.insert("randKey58901", "HelloMap2");
    map3.insert("randKey58", "HelloMap3");
    session.commit();

What to do next

You can enable tracing on multi-partition transactions. For more information, see Server trace options.