Configuring a locking strategy in the ObjectGrid descriptor XML file

You can define an optimistic, a pessimistic, or no locking strategy on each BackingMap in the WebSphere® eXtreme Scale configuration. [.net programming language only]For the backing maps that you are accessing from WebSphere eXtreme Scale Client for .NET, you must define a pessimistic locking strategy.

Before you begin

Decide which locking strategy you want to use. For more information, see Locking strategies.
Deprecated featureDeprecated: Multi-partition transaction operations are deprecated.

About this task

You can configure each BackingMap instance to use one of the following locking strategies:
  • Optimistic locking mode (default)
  • Pessimistic locking mode [.net programming language only](required for .NET applications)
  • None

Procedure

  • [.net programming language only][Java programming language only]Configure a pessimistic locking strategy
    • [.net programming language only][Java programming language only]With the lockStrategy attribute in the ObjectGrid descriptor 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="test">
                  <backingMap name="pessimisticMap"
                      lockStrategy="PESSIMISTIC"/>
              </objectGrid>
          </objectGrids>
      </objectGridConfig>
      
  • [Java programming language only]Configure an optimistic locking strategy
    • With the lockStrategy attribute in the ObjectGrid descriptor 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="test">
                  <backingMap name="optimisticMap"
                      lockStrategy="OPTIMISTIC"/>
              </objectGrid>
          </objectGrids>
      </objectGridConfig>
      
  • [Java programming language only]Configure a no locking strategy
    • With the lockStrategy attribute in the ObjectGrid descriptor XML file:
      Note: BackingMaps that are configured to use a no locking strategy cannot participate in a multi-partition transaction.
      Deprecated featureDeprecated: Multi-partition transaction operations are deprecated.
      <?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="test">
                  <backingMap name="noLockingMap"
                      lockStrategy="NONE"/>
              </objectGrid>
          </objectGrids>
      </objectGridConfig>