Search in sources :

Example 1 with NoOpWarmUpStrategy

use of org.apache.ignite.internal.processors.cache.warmup.NoOpWarmUpStrategy 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;
}
Also used : WarmUpConfiguration(org.apache.ignite.configuration.WarmUpConfiguration) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) WarmUpStrategySupplier(org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategySupplier) LoadAllWarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.LoadAllWarmUpStrategy) NoOpWarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.NoOpWarmUpStrategy) NoOpWarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.NoOpWarmUpStrategy) LoadAllWarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.LoadAllWarmUpStrategy) WarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy)

Aggregations

HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 WarmUpConfiguration (org.apache.ignite.configuration.WarmUpConfiguration)1 LoadAllWarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.LoadAllWarmUpStrategy)1 NoOpWarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.NoOpWarmUpStrategy)1 WarmUpStrategy (org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy)1 WarmUpStrategySupplier (org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategySupplier)1