/** * @param ignite Ignite instance. * @param ccfg Cache configuration. * @return Data transfer object for cache store configuration properties. */ public static VisorCacheStoreConfiguration from(Ignite ignite, CacheConfiguration ccfg) { VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration(); GridCacheAdapter<Object, Object> c = ((IgniteKernal) ignite).internalCache(ccfg.getName()); CacheStore store = c != null && c.context().started() ? c.context().store().configuredStore() : null; cfg.jdbcStore = store instanceof CacheAbstractJdbcStore; cfg.store = compactClass(store); cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory()); cfg.readThrough = ccfg.isReadThrough(); cfg.writeThrough = ccfg.isWriteThrough(); cfg.writeBehindEnabled = ccfg.isWriteBehindEnabled(); cfg.batchSz = ccfg.getWriteBehindBatchSize(); cfg.flushFreq = ccfg.getWriteBehindFlushFrequency(); cfg.flushSz = ccfg.getWriteBehindFlushSize(); cfg.flushThreadCnt = ccfg.getWriteBehindFlushThreadCount(); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration c = super.getConfiguration(gridName); TcpDiscoverySpi disco = new TcpDiscoverySpi(); disco.setIpFinder(ipFinder); c.setDiscoverySpi(disco); CacheConfiguration<?, ?> cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setBackups(1); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setIndexedTypes(Integer.class, Integer.class); c.setCacheConfiguration(cc); return c; }