/** * @return Size of this thread pool. */ int poolSize() { return cctx.config().getPreloadThreadPoolSize(); }
/** * @param cctx Cache context. * @param busyLock Shutdown lock. */ public GridDhtPartitionDemandPool(GridCacheContext<K, V> cctx, ReadWriteLock busyLock) { assert cctx != null; assert busyLock != null; this.cctx = cctx; this.busyLock = busyLock; log = cctx.logger(getClass()); top = cctx.dht().topology(); poolSize = cctx.preloadEnabled() ? cctx.config().getPreloadThreadPoolSize() : 0; if (poolSize > 0) { barrier = new CyclicBarrier(poolSize); dmdWorkers = new ArrayList<>(poolSize); for (int i = 0; i < poolSize; i++) dmdWorkers.add(new DemandWorker(i)); syncFut = new SyncFuture(dmdWorkers); } else { dmdWorkers = Collections.emptyList(); syncFut = new SyncFuture(dmdWorkers); // Calling onDone() immediately since preloading is disabled. syncFut.onDone(); } exchWorker = new ExchangeWorker(); timeout = new AtomicLong(cctx.config().getPreloadTimeout()); }
/** * @param cctx Cache context. * @param busyLock Shutdown lock. */ GridDhtPartitionSupplyPool(GridCacheContext<K, V> cctx, ReadWriteLock busyLock) { assert cctx != null; assert busyLock != null; this.cctx = cctx; this.busyLock = busyLock; log = cctx.logger(getClass()); top = cctx.dht().topology(); int poolSize = cctx.preloadEnabled() ? cctx.config().getPreloadThreadPoolSize() : 0; for (int i = 0; i < poolSize; i++) workers.add(new SupplyWorker()); cctx.io().addHandler(GridDhtPartitionDemandMessage.class, new CI2<UUID, GridDhtPartitionDemandMessage<K, V>>() { @Override public void apply(UUID id, GridDhtPartitionDemandMessage<K, V> m) { processDemandMessage(id, m); } }); depEnabled = cctx.gridDeploy().enabled(); }
/** * @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; }
assertParameter(cc.getPreloadThreadPoolSize() > 0, "preloadThreadPoolSize > 0"); assertParameter(cc.getPreloadBatchSize() > 0, "preloadBatchSize > 0");
preloadDelay = cc.getPreloadPartitionedDelay(); preloadOrder = cc.getPreloadOrder(); preloadPoolSize = cc.getPreloadThreadPoolSize(); preloadTimeout = cc.getPreloadTimeout(); preloadThrottle = cc.getPreloadThrottle();