Program guide > Programming with system APIs and plug-ins > Plug-ins for transforming cached objects



Develop custom arbiters for multi-master replication

Change collisions might occur if the same records can be changed simultaneously in two places. In a multi-master replication topology, domains detect collisions automatically. When a domain detects a collision, it invokes an arbiter. Typically, collisions are resolved using the default collision arbiter. However, an application can provide a custom collision arbiter.

If a domain receives a replicated entry that collides with a collision record, the default arbiter uses the changes from the lexically lowest named domain. For example, if domain A and B generate a conflict for a record, then the change from domain B is ignored. Domain A keeps its version and the record in domain B is changed to match the record from domain A. Domain names are converted to upper case for comparison.

An alternative option is for the multi-master replication topology to call on a custom collision plug-in to decide the outcome. These instructions outline how to develop a custom collision arbiter and configure a multi-master replication topology to use it.


Procedure

  1. Develop a custom collision arbiter and integrate it into your application.

    The class should implement the interface:

    com.ibm.websphere.objectgrid.revision.CollisionArbiter
    

    A collision plug-in has three choices for deciding the outcome of a collision. It can choose the local copy or the remote copy or it can provide a revised version of the entry. A domain provides the following information to a custom collision arbiter:

    • The existing version of the record

    • The collision version of the record

    • A Session object that must be used to create the revised version of the collided entry

    The plug-in method returns an object indicating its decision. The method invoked by the domain to call the plug-in must return true or false, where false means to ignore the collision – the local version remains unchanged and eXtreme Scale will forget that it ever saw the existing version. The method returns a true value if the method used the provided session to create a new, merged version of the record, reconciling the change.

  2. In the objectgrid.xml file, specify to use the custom arbiter plug-in.

    The id must be “CollisionArbiter."

    <dgc:objectGrid name="revisionGrid" txTimeout="10">
            <dgc:bean className="com.you.your_application.
                            CustomArbiter" id="CollisionArbiter">
                <dgc:property name="property" type="java.lang.String"
                            value="propertyValue"/>
            </dgc:bean>
    </dgc:objectGrid>
    


Parent topic:

Plug-ins for transforming cached objects


Related concepts

ObjectTransformer plug-in