IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1

com.ibm.websphere.objectgrid.plugins
OptimisticCallback



An object implementing this interface is used to provide optimistic comparision operations for the values of a Map.
See Also:
    setOptimisticCallback(OptimisticCallback)


Field Summary
public  ByteNULL_OPTIMISTIC_VERSION
           Special value returned by getVersionObjectForValue if the default OptimisticCallback is used by a BackingMap since the com.

Method Summary
public  ObjectgetVersionedObjectForValue(java.lang.Object)
           This may simply return the value (must be a copy) or it may return an attribute of the value that can be used for versioning purposes.
public  voidupdateVersionedObjectForValue(java.lang.Object)
           This method is called whenever a transaction has updated a value and new versioned object is needed.
public  voidserializeVersionedValue(java.lang.Object, java.io.ObjectOutputStream)
           This method will write the versioned value to the specified stream. .
public  ObjectinflateVersionedValue(java.io.ObjectInputStream)
           This method takes the Serializable version of the versioned value and returns the actual versioned value object.

Field Detail

NULL_OPTIMISTIC_VERSION

public 
  static NULL_OPTIMISTIC_VERSION
Special value returned by getVersionObjectForValue if the default OptimisticCallback is used by a BackingMap since the com.ibm.websphere.objectgrid.BackingMap#setOptimisticCallback(OptimisticCallback) method was never called.

Method Detail

getVersionedObjectForValue

public Object getVersionedObjectForValue(Object value)
This may simply return the value (must be a copy) or it may return an attribute of the value that can be used for versioning purposes. This method is called whenever an object is associated with a transaction so that at commit time, we can do qualified updates using this value to detect if the value changed during the optimistic transaction. The Loader also gets this value from the LogElement.
See Also:
    getVersionedValue()
Parameters:
    value - The value to version


Returns:
     Either a copy of the value or a copy of an attribute that can be used for versioning.


updateVersionedObjectForValue

public void updateVersionedObjectForValue(Object value)
This method is called whenever a transaction has updated a value and new versioned object is needed. If the #getVersionedObjectForValue(Object) returned an attribute of the value, then this method typically updates that value with a new version object for the value. If #getVersionedObjectForValue(Object) returned a copy of the value, then this method typically would do nothing.
Parameters:
    value - The value whose version attributed must be updated.


serializeVersionedValue

public void serializeVersionedValue(Object versionedValue,ObjectOutputStream stream)
This method will write the versioned value to the specified stream. Depending on the implementation, the versioned value can be used to identify optimistic update collisions. In the default implementation, the versioned value is just a copy of the original value. Other implementations may have a sequence number or some other object to indicate the version of the value. Since the actual implementation is unknown, this method is provided to perform the proper serialization. The default implementation just does a writeObject.
Parameters:
    versionedValue - the versioned value object
    stream - The stream to write the object to


Throws:
    java.io.IOException


inflateVersionedValue

public Object inflateVersionedValue(ObjectInputStream stream)
This method takes the Serializable version of the versioned value and returns the actual versioned value object. Depending on the implementation, the versioned value can be used to identify optimistic update collisions. In the default implementation, the versioned value is just a copy of the original value. Other implementations may have a sequence number or some other object to indicate the version of the value. Since the actual implementation is unknown, this inflateVersionedValue() method is provided to perform the proper de-serialization. The default implementation just does a readObject.
Parameters:
    stream - The stream where the value was serialized using the serializeVersionedValue method.


Returns:
     Object De-serialized versioned value object.


Throws:
    java.io.IOExceptionjava.lang.ClassNotFoundException


IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1