/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder); CacheConfiguration ccfg1 = new CacheConfiguration(); ccfg1.setBackups(1); ccfg1.setName(CACHE1); ccfg1.setAffinity(new RendezvousAffinityFunction()); ccfg1.setNodeFilter(new TestNodesFilter()); CacheConfiguration ccfg2 = new CacheConfiguration(); ccfg2.setBackups(1); ccfg2.setName(CACHE2); ccfg2.setAffinity(new RendezvousAffinityFunction()); CacheConfiguration ccfg3 = new CacheConfiguration(); ccfg3.setBackups(1); ccfg3.setName(CACHE3); ccfg3.setAffinity(new FairAffinityFunction()); ccfg3.setNodeFilter(new TestNodesFilter()); CacheConfiguration ccfg4 = new CacheConfiguration(); ccfg4.setCacheMode(REPLICATED); ccfg4.setName(CACHE4); ccfg4.setNodeFilter(new TestNodesFilter()); CacheConfiguration ccfg5 = new CacheConfiguration(); ccfg5.setBackups(1); ccfg5.setName(CACHE5); if (gridName.equals(getTestGridName(NODE_CNT - 1))) { cfg.setClientMode(true); cfg.setCacheConfiguration(ccfg5); } else cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3, ccfg4); return cfg; }
/** * Create base cache configuration. * * @param name cache name. * @return Cache configuration with basic properties set. */ private static <K, V> CacheConfiguration<K, V> cacheConfiguration(String name) { CacheConfiguration<K, V> ccfg = new CacheConfiguration<>(name); ccfg.setAffinity(new RendezvousAffinityFunction(false, 32)); ccfg.setStartSize(100); ccfg.setStatisticsEnabled(true); return ccfg; }
/** * @param name Cache name. * @param cacheMode Cache mode. * @param parts Number of partitions. * @return Cache configuration. */ private CacheConfiguration cacheConfiguration(String name, CacheMode cacheMode, int parts) { CacheConfiguration ccfg = new CacheConfiguration(); ccfg.setName(name); ccfg.setCacheMode(cacheMode); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setWriteSynchronizationMode(FULL_SYNC); if (cacheMode == PARTITIONED) ccfg.setBackups(1); ccfg.setAffinity(new RendezvousAffinityFunction(false, parts)); return ccfg; }