IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1

com.ibm.websphere.objectgrid
CopyMode

java.lang.Object
  |
  +--com.ibm.websphere.objectgrid.CopyMode


This class is used to define the "copy" mode when the setCopyMode method of the BackingMap interface is used. The application is expected to pass one of the final static variables that are defined in this class to the setCopyMode method.
See Also:
    setCopyMode(CopyMode, Class)


Field Summary
public  CopyModeCOPY_ON_READ_AND_COMMIT
           The COPY_ON_READ_AND_COMMIT mode is the default mode. This mode ensures.
public  CopyModeCOPY_ON_READ
           The COPY_ON_READ mode improves performance over the COPY_ON_READ_AND_COMMIT mode by eliminating the copy that occurs when a transaction is committed.
public  CopyModeCOPY_ON_WRITE
           The COPY_ON_WRITE mode improves performance over the COPY_ON_READ_AND_COMMIT mode by eliminating the copy that occurs when ObjectMap.
public  CopyModeNO_COPY
           The NO_COPY mode allows an application to promise that it will never modify a value object obtained using an ObjectMap.

Method Summary
public  StringtoString()
           Returns a string representation of the CopyMode.

Inherited Methods

Methods inherited from java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

COPY_ON_READ_AND_COMMIT

public 
  static COPY_ON_READ_AND_COMMIT
The COPY_ON_READ_AND_COMMIT mode is the default mode. This mode ensures that an application never has a reference to the value object that is in the BackingMap, and instead the application is always working with a copy of the value that is in the BackingMap. The copy ensures the application can never inadvertently corrupt the data that is cached in the BackingMap. When an application transaction calls an ObjectMap.get method for a given key, and it is the first access of the ObjectMap entry for that key, a copy of the value is returned. When the transaction is committed, any changes the application committed are copied to the BackingMap to ensure that the application does not have reference to the committed value in BackingMap.

COPY_ON_READ

public 
  static COPY_ON_READ
The COPY_ON_READ mode improves performance over the COPY_ON_READ_AND_COMMIT mode by eliminating the copy that occurs when a transaction is committed. To preserve integrity of BackingMap data, the application promises to destroy every reference it has to an entry once the transaction is committed. This mode results in a ObjectMap.get method returning a copy of the value rather than a reference to the value to ensure that changes made by the application to the value does not affect the BackingMap value until the transaction is committed. However, when the transaction does commit, a copy of changes is not made. Instead, the reference to the copy that was returned by ObjectMap.get is stored in the BackingMap. This is the reason the application must agree to destroy all map entry references once the transaction is committed. If application fails to keep its promise, the application could cause the data cached in BackingMap to become corrupted. If an application is using this mode and it is having problems, then switch to COPY_ON_READ_AND_COMMIT mode to see if the problem still exists. If the problem goes away, then more than likely the application is failing to destroy all of its references after the transaction has committed.

COPY_ON_WRITE

public 
  static COPY_ON_WRITE
The COPY_ON_WRITE mode improves performance over the COPY_ON_READ_AND_COMMIT mode by eliminating the copy that occurs when ObjectMap.get is called for the first time by a transaction for a given key. Instead, the ObjectMap.get method returns a proxy to the value rather than a direct reference to the value object itself. The proxy ensures that a copy of the value is not made unless the application calls a set method on the value interface that is passed on the BackingMap#setCopyMode(CopyMode, Class) method. Thus, the proxy provides a "copy on write" implementation. When a transaction commits, the BackingMap examines the proxy to determine if any copy was made as a result of a set method being called. If a copy was made, then the reference to that copy is stored in the BackingMap. The big advantage of this mode is a value is never copied on read or at commit when the transaction never calls a set method to mutate the value.

NO_COPY

public 
  static NO_COPY
The NO_COPY mode allows an application to promise that it will never modify a value object obtained using an ObjectMap.get method in exchange for performance improvements. If this mode is used, no copy of the value is ever made. If the application breaks its promise and does modify values, then data in the BackingMap will be corrupted. This mode is primarily useful for read only maps where data is never modified by the application. If the application is using this mode and it is having problems, then switch to COPY_ON_READ_AND_COMMIT mode to see if the problem still exists. If the problem goes away, then more than likely the application is not keeping its promise and is modifying the value returned by ObjectMap.get method (either during transaction or after transaction has committed).

Method Detail

toString

public String toString()
Returns a string representation of the CopyMode.


Returns:
     a string representation of the CopyMode.


IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1