| IBM WebSphere Extended Deployment (XD)TM
Release 6.0 |
This interface is useful in a replicated scenario. If while a map is being preloaded the primary fails before preload is complete the normally the new replica removes all old replicated entries and then restarts preload. This can waste a considerable amount of resources and delay the map coming online. Map Loaders can also implement this interface and the replication manager will then call the checkPreloadStatus method to determine what to do when a replica has become the primary. If the controller determines that the map is already fully loaded then it should return preloaded already. If it determines it cannot recover then it should return full preload needed. The ObjectGrid then clears the Map and invokes a 'cold' preload. Finally, if it returns partial preload needed then the controller doesn't clear the map and then invokes the normal preload method. The Loader can then continue with preload.
How could an application know whether a preload completely partially or not? Use an extra Map called "PreloadStatus". The Map has a string key (the map name) and a value indicating the last block preloaded in to the Map. When Loader#preload is invoked then as part of each transaction, a value should be updated in the status map. This value should hold enough state to allow a second JVM to continue with preload from this point. It might just be the last key loaded as an example. When preload is complete then it should remove the entry.
The checkPreloadStatus method when invoked would just need to check the map entry in the status map for this map. If an entry is present then return partial preload needed. If no entry is present then return preloaded already. If it can't figure out where to start from (usually means an application bug) then full preload needed should be returned.
If the map is empty when the replica is promoted to primary then this method isn't called at all. The ObjectGrid will always try to do a full preload. If the map is not empty then the check method is invoked and its return code indicates how the Map will be treated.
If the application is using a multiple related Maps but is using a single Loader to preload all the maps
together then all Maps Loaders should have a ReplicaPreloadController and they should all return the same value. The
'main' Map can then continue preloading while the other Maps preload methods simply implement a no operation.
See Also:
Loader
Method Summary | |
---|---|
public
ReplicaPreloadController.Status | checkPreloadStatus(com.ibm.websphere.objectgrid.Session, com.ibm.websphere.objectgrid.BackingMap)
This is called when a replica is promoted to primary. The method should return a status indicating.
|
Method Detail |
public ReplicaPreloadController.Status checkPreloadStatus( | Session session , | BackingMap bmap )
|
session
-
A session to examine the side status Map or any other maps.
bmap
-
The Map being recovered
| IBM WebSphere Extended Deployment (XD)TM
Release 6.0 |