/** * @param collocated Collocated flag. * @return Collection configuration. */ protected final CollectionConfiguration config(boolean collocated) { CollectionConfiguration cfg = collectionConfiguration(); cfg.setCollocated(collocated); return cfg; }
@Override public void apply(Ignite ignite) { for (int i = 0; i < 100; i++) { CollectionConfiguration colCfg = new CollectionConfiguration(); colCfg.setCollocated(collocated); colCfg.setBackups(1); colCfg.setCacheMode(PARTITIONED); colCfg.setAtomicityMode(i % 2 == 0 ? TRANSACTIONAL : ATOMIC); IgniteSet set = ignite.set("set-" + i, colCfg); set.close(); } } });
final CollectionConfiguration colCfg = collectionConfiguration(); colCfg.setCollocated(false); colCfg.setGroupName("testGroup"); colCfg.setCacheMode(CacheMode.PARTITIONED); colCfg.setCollocated(true);
final CollectionConfiguration colCfg = collectionConfiguration(); colCfg.setCollocated(false); colCfg.setGroupName("testGroup"); colCfg.setCacheMode(CacheMode.PARTITIONED); colCfg.setCollocated(true);
final CollectionConfiguration colCfg = collectionConfiguration(); colCfg.setCollocated(false); colCfg.setCacheMode(CacheMode.PARTITIONED); colCfg.setGroupName("testGroup"); colCfg.setCollocated(true);
final CollectionConfiguration colCfg = collectionConfiguration(); colCfg.setCollocated(false); colCfg.setCacheMode(CacheMode.PARTITIONED); colCfg.setGroupName("testGroup"); colCfg.setCollocated(true);
/** * @param collocated Collocation flag. */ private void testCacheReuse(boolean collocated) { Ignite ignite = grid(0); CollectionConfiguration colCfg = collectionConfiguration().setCollocated(collocated); colCfg.setAtomicityMode(ATOMIC); colCfg.setGroupName("grp1"); IgniteSet set1 = ignite.set("set1", colCfg); IgniteSet set2 = ignite.set("set2", colCfg); assertEquals(separated(set1), cctx(set1).cacheId() != cctx(set2).cacheId()); colCfg.setAtomicityMode(TRANSACTIONAL); IgniteSet set3 = ignite.set("set3", colCfg); IgniteSet set4 = ignite.set("set4", colCfg); assertEquals(separated(set3), cctx(set3).cacheId() != cctx(set4).cacheId()); assertTrue(cctx(set1).cacheId() != cctx(set3).cacheId()); assertTrue(cctx(set1).groupId() == cctx(set3).groupId()); colCfg.setGroupName("gtp2"); IgniteSet set5 = ignite.set("set5", colCfg); IgniteSet set6 = ignite.set("set6", colCfg); assertEquals(separated(set5), cctx(set5).cacheId() != cctx(set6).cacheId()); assertTrue(cctx(set1).groupId() != cctx(set5).groupId()); Stream.of(set1, set2, set3, set4, set5, set6).forEach(IgniteSet::close); }
public void initializeCache() throws Exception { CacheConfiguration<String, Integer> cacheCfg = new CacheConfiguration<>(); cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheCfg.setName(CHANNELS); cacheCfg.setBackups(2); channelCache = ignite.getOrCreateCache(cacheCfg); logger.info("Channel cache:"+channelCache); colCfg = new CollectionConfiguration(); colCfg.setCollocated(true); colCfg.setBackups(1); channelSize = Integer.parseInt(System.getProperty(CHANNEL_CAPACITY, DEFAULT_CHANNEL_CAPACITY)); logger.info("Starting alert receiver"); }
public void initIgniteCache() { cacheCfg = new CacheConfiguration<>(); cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheCfg.setName(MCM_METRICS); cacheCfg.setBackups(2); seriesLookup = ignite.getOrCreateCache(cacheCfg); colCfg = new CollectionConfiguration(); colCfg.setCollocated(true); colCfg.setBackups(1); colCfg.setCacheMode(CacheMode.REPLICATED); seriesSize = Integer.parseInt(System.getProperty(SERIES_CAPACITY, DEFAULT_SERIES_CAPACITY)); cfg = new CollectionConfiguration(); cfg.setBackups(1); cfg.setCacheMode(CacheMode.REPLICATED); logger.info("Initialized Ignite cache for performance monitoring"); }