IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1

com.ibm.websphere.objectgrid.plugins
Loader



Data in a map sometimes are backed up by a "database". This "database" can be any kind of storage. It could be database, a text file, or even a in-memory object. This Loader plugin allows users plug in their own "database" access protocol to load and store data.

This Loader instance will be used by a BaseMap implementation at runtime.


See Also:
    setLoader(Loader)


Field Summary
public  Loader.SpecialValueKEY_NOT_FOUND
          

Method Summary
public  voidpreloadMap(com.ibm.websphere.objectgrid.Session, com.ibm.websphere.objectgrid.BackingMap)
           This signals the Loader to preload the data into the Map. The Session.
public  Listget(com.ibm.websphere.objectgrid.TxID, java.util.List, boolean)
           Returns the list of values corresponding to the set of keys passed in. Each key.
public  voidbatchUpdate(com.ibm.websphere.objectgrid.TxID, com.ibm.websphere.objectgrid.plugins.LogSequence)
           This is called to tell the Loader to write these changes to the backend. The LogSequence is.

Field Detail

KEY_NOT_FOUND

public 
  static KEY_NOT_FOUND
A special value type indicating that the key cannot be found

Method Detail

preloadMap

public void preloadMap(Session session,BackingMap backingMap)
This signals the Loader to preload the data into the Map. The Session parameter should be used for session demarcation. The session parameter has no security enabled and allows the various Maps to be accessed without credentials. The Loader is considered system code. The loader should use the beginNoWriteThrough for all sessions. It should also use use several smaller sessions when the amount of data is very large to avoid running out of log space.

This method also provides Loader initialization semantics since it is called when the ObjectGrid gets initialized. The Session and BackingMap parameters should provide all necessary access to the various ObjectGrid objects, such as the PartitionManager.

The preload can be asynchronous when the attribute set async preload is true on the BackingMap. Objects implementing this interface should also consider implementing the ReplicaPreloadController interface as this allows a recoverable preload when the Map is being replicated. This allows a replica to resume preload if the primary fails before preload completes.


See Also:

    ReplicaPreloadControllerBackingMap
Parameters:
    session - Session reference to use for demarcating sessions.
    backingMap - BackingMap reference to load with data.


Throws:
    com.ibm.websphere.objectgrid.plugins.LoaderException


get

public List get(TxID txid,List keyList, boolean forUpdate)
Returns the list of values corresponding to the set of keys passed in. Each key provided will have a corresponding entry in the returned list. If no entry exists for a specified key, KEY_NOT_FOUND will be returned as the value.
Parameters:
    txid - the transaction ID object
    keyList - Collection of keys
    forUpdate - If true then do a select for update.


Returns:
     List of Object values


Throws:
    com.ibm.websphere.objectgrid.plugins.LoaderException


batchUpdate

public void batchUpdate(TxID txid,LogSequence sequence)
This is called to tell the Loader to write these changes to the backend. The LogSequence is the set of changes that have been applied to the Map associated with this loader. If the Map uses a ValueInterface then the Loader can use partial update support for improved performance. If the Loader knows the values are modified then it should update the object returned from LogElement.getCurrentValue with the value actually in the database. This rule applies when using automatic sequence columns in a database or when using database triggers to modify the value indirectly. Under no circumstances should be commited value be modified.
See Also:
    ValueProxyInfogetCurrentValue()
Parameters:
    txid - the transaction id object
    sequence - LogSequence (set of changes that have been applied to this map)


Throws:
    com.ibm.websphere.objectgrid.plugins.LoaderExceptioncom.ibm.websphere.objectgrid.plugins.OptimisticCollisionException


IBM WebSphere Extended Deployment (XD)TM
Release 6.0.1