[Java programming language only]

Writing a BackingMapPlugin plug-in

A BackingMap plug-in implements the BackingMapPlugin mix-in interface, which you can use to receive extended capabilities for managing its life cycle.

About this task

Any existing BackingMap plug-in that also implements the BackingMapPlugin interface will automatically receive the extended set of lifecycle events during its construction and use.

The BackingMapPlugin interface provides methods to set or modify the state of the plug-in, as well as methods to introspect the current state of the plug-in.

All methods must be implemented correctly, and the WebSphere® eXtreme Scale runtime environment verifies the method behavior under certain circumstances. For example, after calling the initialize() method, the eXtreme Scale runtime environment calls the isInitialized() method to ensure that the method successfully completed the appropriate initialization.

Procedure

  1. Implement the BackingMapPlugin interface so that the BackingMapPlugin plug-in receives notifications about significant eXtreme Scale events.
    Three main categories of methods exist:
    Properties methods Purpose
    setBackingMap() Called to set the BackingMap instance the plug-in is used for.
    getBackingMap() Called to get or confirm the BackingMap instance the plug-in is used for.
    Initialization methods Purpose
    initialize() Called to initialize the BackingMapPlugin plug-in.
    isInitialized() Called to get or confirm the initialization status of the plug-in.
    Destruction methods Purpose
    destroy() Called to destroy the BackingMapPlugin plug-in.
    isDestroyed() Called to get or confirm the destroyed status of the plug-in.

    See the API documentation for more information about these interfaces.

  2. Configure a BackingMapPlugin plug-in with XML.
    Assume that the class name of an eXtreme Scale Loader plug-in is the com.company.org.MyBackingMapPluginLoader class, which implements the Loader interface and the BackingMapPlugin interface.

    In the following code example, the custom transaction callback, which will ultimately receive extended life cycle events, is generated and added to a BackingMap.

    You can also configure a BackingMapPlugin plug-in using XML. 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">
                <backingMap name="Book" pluginCollectionRef="myPlugins" />
            </objectGrid>
        </objectGrids>
        <backingMapPluginCollections>
            <backingMapPluginCollection id="myPlugins">
                <bean id="Loader"
                      className="com.company.org.MyBackingMapPluginLoader" />
            </backingMapPluginCollection>
        </backingMapPluginCollections>
    </objectGridConfig>
  3. Provide the myGrid.xml file to the ObjectGridManager plug-in to facilitate the creation of this configuration.

Results

The BackingMap instance that is created has a Loader that receives BackingMapPlugin life cycle events.