Change collisions might occur if the same records
can be
changed simultaneously in two places. In a multi-master replication
topology, catalog service domains detect collisions automatically.
When a catalog service domain detects a collision, it invokes an arbiter.
Typically, collisions are resolved with the default collision arbiter.
However, an application can provide a custom collision arbiter.
About this task
If a catalog service domain receives a replicated entry
that collides with a collision record, the default arbiter uses the
changes from the lexically lowest named catalog service 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 uppercase 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
- Develop a custom collision arbiter and integrate it into
your application.
The class must 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 catalog service 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
that indicates 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. When the collision
is ignored, the local version remains unchanged and the arbiter forgets
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.
- In the objectgrid.xml file, specify
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>