Search in sources :

Example 1 with WarmUpStrategy

use of org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy in project ignite by apache.

the class IgniteCacheDatabaseSharedManager method validateConfiguration.

/**
 * @param memCfg configuration to validate.
 * @throws IgniteCheckedException In case of validation violation.
 */
private void validateConfiguration(DataStorageConfiguration memCfg) throws IgniteCheckedException {
    checkPageSize(memCfg);
    DataRegionConfiguration[] regCfgs = memCfg.getDataRegionConfigurations();
    Set<String> regNames = new HashSet<>();
    checkSystemDataRegionSizeConfiguration(memCfg.getSystemDataRegionConfiguration().getInitialSize(), memCfg.getSystemDataRegionConfiguration().getMaxSize());
    Map<Class<? extends WarmUpConfiguration>, WarmUpStrategy> warmUpStrategies = CU.warmUpStrategies(cctx.kernalContext());
    if (regCfgs != null) {
        for (DataRegionConfiguration regCfg : regCfgs) checkDataRegionConfiguration(memCfg, regNames, regCfg, warmUpStrategies);
    }
    checkDataRegionConfiguration(memCfg, regNames, memCfg.getDefaultDataRegionConfiguration(), warmUpStrategies);
    checkWalArchiveSizeConfiguration(memCfg, log);
    checkExistenceWarmUpConfiguration(memCfg.getDefaultWarmUpConfiguration(), warmUpStrategies, (warmUpCfg) -> "Unknown default warm-up configuration: " + warmUpCfg);
}
Also used : DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) WarmUpConfiguration(org.apache.ignite.configuration.WarmUpConfiguration) WarmUpStrategy(org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy) HashSet(java.util.HashSet)

Example 2 with WarmUpStrategy

use of org.apache.ignite.internal.processors.cache.warmup.WarmUpStrategy 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

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