IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins
Interface OptimisticCallback

All Known Implementing Classes:
NoVersioningOptimisticCallback

Deprecated. This plug-in is deprecated in version 7.1.1. Use the ValueSerializerPlugin with the ValueDataSerializer.Versionable mix-in interface.

@Deprecated
public interface OptimisticCallback

An object implementing this interface is used to provide optimistic comparison operations for the values of a Map.

An OptimisticCallback implementation that also implements the BackingMapLifecycleListener interface will be automatically added as an EventListener on the BackingMap when the callback set on the backing map.

An OptimisticCallback may also implement the BackingMapPlugin interface in order to receive enhanced BackingMap plug-in lifecycle method calls. The plug-in is then also required to correctly implement each of the bean methods related to introspection of its state (for example isInitialized(), isDestroyed(), etc).

Since:
WAS XD 6.0
See Also:
BackingMap.addMapEventListener(EventListener), BackingMap.setLockStrategy(LockStrategy), BackingMap.setOptimisticCallback(OptimisticCallback), LockStrategy.OPTIMISTIC

Field Summary
static Byte NULL_OPTIMISTIC_VERSION
          Deprecated. Special value returned by getVersionObjectForValue if the default OptimisticCallback is used by a BackingMap since the BackingMap.setOptimisticCallback(OptimisticCallback) method was never called.
 
Method Summary
 Object getVersionedObjectForValue(Object value)
          Deprecated. Returns the value (must be a copy) or it may return an attribute of the value that can be used for versioning purposes.
 Object inflateVersionedValue(ObjectInputStream stream)
          Deprecated. Reads a versioned value object from the specified stream.
 void serializeVersionedValue(Object versionedValue, ObjectOutputStream stream)
          Deprecated. Writes the versioned value object to the specified stream.
 void updateVersionedObjectForValue(Object value)
          Deprecated. Called whenever a transaction has updated a value and a new versioned object is needed.
 

Field Detail

NULL_OPTIMISTIC_VERSION

static final Byte NULL_OPTIMISTIC_VERSION
Deprecated. 
Special value returned by getVersionObjectForValue if the default OptimisticCallback is used by a BackingMap since the BackingMap.setOptimisticCallback(OptimisticCallback) method was never called.

Method Detail

getVersionedObjectForValue

Object getVersionedObjectForValue(Object value)
Deprecated. 
Returns 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, the ObjectGrid runtime 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.

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.
See Also:
Loader, LogElement.getVersionedValue()

updateVersionedObjectForValue

void updateVersionedObjectForValue(Object value)
Deprecated. 
Called whenever a transaction has updated a value and a new versioned object is needed.

If the getVersionedObjectForValue(Object) method returned an attribute of the value, this method typically updates that value with a new version object for the value. If the getVersionedObjectForValue(Object) method returned a copy of the value, then this method typically does nothing.

Parameters:
value - The value whose version attribute must be updated.
See Also:
getVersionedObjectForValue(Object)

serializeVersionedValue

void serializeVersionedValue(Object versionedValue,
                             ObjectOutputStream stream)
                             throws IOException
Deprecated. 
Writes the versioned value object 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:
IOException - if an error occurs during processing of this method

inflateVersionedValue

Object inflateVersionedValue(ObjectInputStream stream)
                             throws IOException,
                                    ClassNotFoundException
Deprecated. 
Reads a versioned value object from the specified 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 method is provided to perform the proper de-serialization. The default implementation just does a readObject.

Parameters:
stream - the ObjectInputStream object to read the versioned value object from
Returns:
de-serialized versioned value object.
Throws:
IOException - if an error occurs during processing of this method
ClassNotFoundException - if the versioned value class isn't found
See Also:
serializeVersionedValue(Object, ObjectOutputStream)

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.