Loader インターフェースでプリロード・メソッドを使用して、クライアント・ローダーを呼び出すことができます。
void preloadMap(Session session, BackingMap backingMap) throws LoaderException;
このメソッドは、ローダーにデータをマップにプリロードするように通知します。ローダー実装では、クライアント・ローダーを使用して、データをそのすべての区画にプリロードすることができます。例えば、JPA ローダーでは、クライアント・ローダーを使用して、データをマップにプリロードします。詳しくは、クライアント・ベース JPA プリロード・ユーティリティーの概要を参照してください。
void preloadMap (Session session, BackingMap backingMap) throws LoaderException {
....
ObjectGrid objectGrid = session.getObjectGrid();
int partitionId = backingMap.getPartitionId();
int numPartitions = backingMap.getPartitionManager().getNumOfPartitions();
// Only call client loader data in one partition
if (partitionId == preloadPartition) {
ClientLoader c = ClientLoaderFactory.getClientLoader();
// Call the client loader to load the data
try {
c.load(objectGrid, "CUSTOMER", "customerPU",
null, entityClass, null, null, true, null);
} catch (ObjectGridException e) {
LoaderException le = new LoaderException("Exception caught in ObjectMap " +
ogName + "." + mapName);
le.initCause(e);
throw le;
}
}
}