|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReplicaPreloadController
A Map Loader should also implement this interface in the following circumstances.
This interface is useful in a replicated scenario. If a map is being
preloaded and the primary fails before preload is complete, normally the new
replica removes all old replicated entries and restarts preload. This process
can waste a considerable amount of resources and delay the map coming online.
Map Loaders can implement this interface and the replication manager will
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, it should return preloaded already. If it determines
it cannot recover, it should return full preload needed. ObjectGrid clears
the Map and invokes a 'cold' preload. Finally, if it returns partial preload
needed, the controller doesn't clear the map and 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 a Loader's preload method is invoked, 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, 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, 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), full preload needed should be returned.
If the map is empty when the replica is promoted to primary, this method isn't called at all. ObjectGrid will always try to do a full preload. If the map is not empty, 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, all Map 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.
Loader.preloadMap(Session, BackingMap)
Nested Class Summary | |
---|---|
static class |
ReplicaPreloadController.Status
This class is used as an enumerator for the Map preload status. |
Method Summary | |
---|---|
ReplicaPreloadController.Status |
checkPreloadStatus(Session session,
BackingMap bmap)
Called when a replica is promoted to primary. |
Method Detail |
---|
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
ReplicaPreloadController.Status.FULL_PRELOAD_NEEDED
,
ReplicaPreloadController.Status.PARTIAL_PRELOAD_NEEDED
,
ReplicaPreloadController.Status.PRELOADED_ALREADY
|
IBM WebSphereTM eXtreme Scale, Release 8.6 API Specification |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |