use of org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategySupplier in project ignite by apache.
the class GridCacheUtils method warmUpStrategies.
/**
* Getting available warming strategies.
*
* @param kernalCtx Kernal context.
* @return Mapping configuration to strategy.
*/
public static Map<Class<? extends WarmUpConfiguration>, WarmUpStrategy> warmUpStrategies(GridKernalContext kernalCtx) {
Map<Class<? extends WarmUpConfiguration>, WarmUpStrategy> strategies = new HashMap<>();
// Adding default strategies.
WarmUpStrategy[] defStrats = { new NoOpWarmUpStrategy(), new LoadAllWarmUpStrategy(kernalCtx.log(LoadAllWarmUpStrategy.class), () -> kernalCtx.cache().cacheGroups()) };
for (WarmUpStrategy<?> strategy : defStrats) strategies.putIfAbsent(strategy.configClass(), strategy);
// Adding strategies from plugins.
WarmUpStrategySupplier[] suppliers = kernalCtx.plugins().extensions(WarmUpStrategySupplier.class);
if (nonNull(suppliers)) {
for (WarmUpStrategySupplier supplier : suppliers) {
for (WarmUpStrategy<?> strategy : supplier.strategies()) strategies.putIfAbsent(strategy.configClass(), strategy);
}
}
return strategies;
}
Aggregations