/** * @return {@code True} if preload is enabled. */ public boolean preloadEnabled() { return cacheCfg.getPreloadMode() != NONE; }
@Override public void apply(Object t) { U.log(log, "Completed preloading in " + cctx.config().getPreloadMode() + " mode " + "[cache=" + cctx.name() + ", time=" + (U.currentTimeMillis() - start) + " ms]"); } });
/** * Checks that preload-order-dependant caches has SYNC or ASYNC preloading mode. * * @param cfgs Caches. * @return Maximum detected preload order. * @throws GridException If validation failed. */ private int validatePreloadOrder(GridCacheConfiguration[] cfgs) throws GridException { int maxOrder = 0; for (GridCacheConfiguration cfg : cfgs) { int preloadOrder = cfg.getPreloadOrder(); if (preloadOrder > 0) { if (cfg.getCacheMode() == LOCAL) throw new GridException("Preload order set for local cache (fix configuration and restart the " + "node): " + cfg.getName()); if (cfg.getPreloadMode() == GridCachePreloadMode.NONE) throw new GridException("Only caches with SYNC or ASYNC preload mode can be set as preload " + "dependency for other caches [cacheName=" + cfg.getName() + ", preloadMode=" + cfg.getPreloadMode() + ", preloadOrder=" + cfg.getPreloadOrder() + ']'); maxOrder = Math.max(maxOrder, preloadOrder); } else if (preloadOrder < 0) throw new GridException("Preload order cannot be negative for cache (fix configuration and restart " + "the node) [cacheName=" + cfg.getName() + ", preloadOrder=" + preloadOrder + ']'); } return maxOrder; }
GridCacheConfiguration cfg = cache.configuration(); if (cfg.getPreloadMode() == SYNC) { if (cfg.getCacheMode() == REPLICATED || (cfg.getCacheMode() == PARTITIONED && cfg.getPreloadPartitionedDelay() >= 0))
/** * @param ccfg Cache configuration. * @return Data transfer object for preload configuration properties. */ public static VisorPreloadConfig from(GridCacheConfiguration ccfg) { VisorPreloadConfig cfg = new VisorPreloadConfig(); cfg.mode(ccfg.getPreloadMode()); cfg.batchSize(ccfg.getPreloadBatchSize()); cfg.threadPoolSize(ccfg.getPreloadThreadPoolSize()); cfg.partitionedDelay(ccfg.getPreloadPartitionedDelay()); cfg.throttle(ccfg.getPreloadThrottle()); cfg.timeout(ccfg.getPreloadTimeout()); return cfg; }
U.log(log, "Starting preloading in " + cctx.config().getPreloadMode() + " mode: " + cctx.name());
cc.getName() + ']'); if (cc.getPreloadMode() != GridCachePreloadMode.NONE) { assertParameter(cc.getPreloadThreadPoolSize() > 0, "preloadThreadPoolSize > 0"); assertParameter(cc.getPreloadBatchSize() > 0, "preloadBatchSize > 0"); U.warn(log, "Preload delay is supported only for partitioned caches (will ignore): " + cc.getName(), "Will ignore preload delay for cache: " + cc.getName()); else if (cc.getPreloadMode() == SYNC) { if (delay < 0) { U.warn(log, "Ignoring SYNC preload mode with manual preload start (node will not wait for " +
partDistro = GridCacheUtils.distributionMode(cfg); preloadBatchSize = cfg.getPreloadBatchSize(); preloadMode = cfg.getPreloadMode(); qryIdxEnabled = cfg.isQueryIndexEnabled(); seqReserveSize = cfg.getAtomicSequenceReserveSize();
if (cfg.getPreloadMode() == null) cfg.setPreloadMode(ASYNC);
pessimisticTxLogSize = cc.getPessimisticTxLogSize(); portableEnabled = cc.isPortableEnabled(); preloadMode = cc.getPreloadMode(); preloadBatchSize = cc.getPreloadBatchSize(); preloadDelay = cc.getPreloadPartitionedDelay();