/** * @param ccfg Cache configuration. * @return Data transfer object for write-behind cache configuration properties. */ public static VisorWriteBehindConfig from(GridCacheConfiguration ccfg) { VisorWriteBehindConfig cfg = new VisorWriteBehindConfig(); cfg.enabled(ccfg.isWriteBehindEnabled()); cfg.batchSize(ccfg.getWriteBehindBatchSize()); cfg.flushFrequency(ccfg.getWriteBehindFlushFrequency()); cfg.flushSize(ccfg.getWriteBehindFlushSize()); cfg.flushThreadCount(ccfg.getWriteBehindFlushThreadCount()); return cfg; }
/** * Creates a wrapped cache store if write-behind cache is configured. * * @param gridName Grid name. * @param cfg Cache configuration. * @param near Whether or not store retrieved for near cache. * @return Instance if {@link GridCacheWriteBehindStore} if write-behind store is configured, * or user-defined cache store. */ @SuppressWarnings({"unchecked"}) private GridCacheStore cacheStore(String gridName, GridCacheConfiguration cfg, boolean near) { if (cfg.getStore() == null || !cfg.isWriteBehindEnabled()) return cfg.getStore(); // Write-behind store is used in DHT cache only. if (!near) { GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(gridName, cfg.getName(), log, cfg.getStore()); store.setFlushSize(cfg.getWriteBehindFlushSize()); store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount()); store.setFlushFrequency(cfg.getWriteBehindFlushFrequency()); store.setBatchSize(cfg.getWriteBehindBatchSize()); return store; } else return cfg.getStore(); }
txBatchUpdate = cfg.isBatchUpdateOnCommit(); txSerEnabled = cfg.isTxSerializableEnabled(); writeBehindBatchSize = cfg.getWriteBehindBatchSize(); writeBehindEnabled = cfg.isWriteBehindEnabled(); writeBehindFlushFreq = cfg.getWriteBehindFlushFrequency();
cc.getName()); assertParameter(cc.getWriteBehindBatchSize() > 0, "writeBehindBatchSize > 0"); assertParameter(cc.getWriteBehindFlushSize() >= 0, "writeBehindFlushSize >= 0"); assertParameter(cc.getWriteBehindFlushFrequency() >= 0, "writeBehindFlushFrequency >= 0");
txBatchUpdate = cc.isBatchUpdateOnCommit(); txSerEnabled = cc.isTxSerializableEnabled(); writeBehindBatchSize = cc.getWriteBehindBatchSize(); writeBehindEnabled = cc.isWriteBehindEnabled(); writeBehindFlushFreq = cc.getWriteBehindFlushFrequency();