IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1

com.ibm.websphere.objectgrid.plugins
OptimisticCollisionException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--com.ibm.websphere.objectgrid.ObjectGridException
                    |
                    +--com.ibm.websphere.objectgrid.plugins.OptimisticCollisionException


This exception is thrown when optimistic locking strategy is used and more than one update transaction collides on the same map entry of a ObjectGrid instance. The first transaction to commit updates the version object for the map entry. Other transactions that read this same map entry prior to the commit have the prior version object. When the other transactions try to commit, the version object it read will not match the version that was last committed. Thus the other transactions are prevented from updating a map entry using "stale" data.

Since this exception indicates the map entry contains stale data, ObjectGrid will invalidate the stale map entries as identified by the key parameter that is passed to the #OptimisticCollisionException(String, String, String, Object) method. If this exception is thrown by a Loader plugin and a null reference is used as the key parameter by the Loader, then ObjectGrid assumes the Loader does not know which entry caused the exception. In this case, ObjectGrid will use the LogSequence that was passed to the com.ibm.websphere.objectgrid.plugins.Loader#batchUpdate(TxID, LogSequence) method to determine which map entries to invalidate. Each LogElement in the LogSequence of type update or delete will be invalidated.



Constructor Summary
OptimisticCollisionException(java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
           Creates exception for specified key of a map of an ObjectGrid.


Method Summary
public  StringgetGridName()
           Get the name of the ObjectGrid instance optimistic collision occured in.
public  StringgetMapName()
           Get the map name the optimistic collision occured in.
public  ObjectgetKey()
           Get the key that caused this exception to occur.

Inherited Methods

Methods inherited from com.ibm.websphere.objectgrid.ObjectGridException
getCause, initCause, printStackTrace, printStackTrace, printStackTrace
Methods inherited from java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, setStackTrace, toString
Methods inherited from java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

OptimisticCollisionException

public OptimisticCollisionException( String message,String gridName,String mapName,Object key)
Creates exception for specified key of a map of an ObjectGrid.
Parameters:
message - the message text for the exception.
gridName - the name of the grid the map belongs to.
mapName - the name of the map.
key - the key or array of keys that caused the optimistic collision exception to occur. If more than a single key caused the exception, then an array of object should be used for this parameter. Each array element in this case identifies a single map entry that caused the exception to occur. This is useful when Loader uses the batch update support of a JDBC driver. A null reference should be passed if unable to determine which key or set of keys caused this exception to occur.


Method Detail

getGridName

public String getGridName()
Get the name of the ObjectGrid instance optimistic collision occured in.


Returns:
     name of the ObjectGrid instance.


getMapName

public String getMapName()
Get the map name the optimistic collision occured in.


Returns:
     name of map.


getKey

public Object getKey()
Get the key that caused this exception to occur.


Returns:
     key object or array of key objects that caused this exception to occur.


IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1