extreme scale util class (七)

2014-11-24 08:24:25 · 作者: · 浏览: 5
.UserProfile;

import com.fmr.pzn.db.DBTableWrapper;

import com.fmr.pzn.db.DSWrapper;

import com.ibm.websphere.objectgrid.KeyNotFoundException;

import com.ibm.websphere.objectgrid.ObjectGrid;

import com.ibm.websphere.objectgrid.ObjectGridException;

import com.ibm.websphere.objectgrid.ObjectMap;

import com.ibm.websphere.objectgrid.revision.CollisionArbiter;

import com.ibm.websphere.objectgrid.revision.CollisionData;

import com.ibm.websphere.objectgrid.revision.RevisionElement;

/*******************************************************************************/

/* Class Name: ItemArbiter */

/* */

/* Description: This class is responsible for determining "winners" of */

/* collisions between multiple Item objects. The class implements the */

/* CollisionArbiter interface to do that. There are two methods on the */

/* interface - arbitrateCollision and initialize. */

/* */

/*******************************************************************************/

public final class ItemArbiter implements CollisionArbiter {

private OracleDataSource ds = null;

/*******************************************************************************/

/* Method Name: arbitrateCollision */

/* */

/* Description: This method gets control from WXS following a collision of */

/* Item objects (one from each domain). The method looks */

/* at the update source of the object to do determine which object */

/* should be kept. Please see the design documentation for more */

/* details. */

/* */

/* Input: */

/*

* CollisionData - This object gives us access to both parties of a

* collision

*/

/* (Existing and Colliding), the key of the Existing object, */

/* and the map name. */

/* */

/* Returns: */

/* Resolution.KEEP - WXS is to keep the Existing object */

/* Resolution.OVERRIDE - WXS is to keep the Colliding object */

/* Resolution.REVISE - The arbiter has decided to create a custom object */

/* and write it to the grid. */

/*******************************************************************************/

@Override

public Resolution arbitrateCollision(CollisionData collisiondata) {

ObjectMap map = null;

String collisionKey = null;

Object rowCollisionKey = null;

Resolution resolution = Resolution.KEEP;

System.out.println( "Arbiter: Processing Collision");

if (collisiondata != null) {

RevisionElement newDataElement = collisiondata.getCollision();

RevisionElement existingElement = collisiondata.getExisting();

rowCollisionKey = collisiondata.getKey();

collisionKey = collisiondata.getKey().toString();

map = collisiondata.getMap();

// c