use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class GridCacheNearReadersSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setRebalanceMode(NONE);
cacheCfg.setAffinity(aff);
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setBackups(aff.backups());
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
cacheCfg.setNearConfiguration(nearCfg);
cfg.setCacheConfiguration(cacheCfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, cntr.getAndIncrement()));
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class GridCachePartitionedFilteredPutSelfTest method cacheConfiguration.
/**
* @return Cache configuration.
*/
private CacheConfiguration cacheConfiguration() {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(PARTITIONED);
cfg.setBackups(1);
cfg.setAtomicityMode(TRANSACTIONAL);
cfg.setNearConfiguration(new NearCacheConfiguration());
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class GridCachePartitionedBasicStoreMultiNodeSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setBackups(1);
cc.setCacheStoreFactory(new StoreFactory());
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
cc.setNearConfiguration(nearCacheConfiguration());
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class TxOptimisticDeadlockDetectionTest method createCache.
/**
* @param cacheMode Cache mode.
* @param syncMode Write sync mode.
* @param near Near.
* @return Created cache.
*/
@SuppressWarnings("unchecked")
private IgniteCache createCache(CacheMode cacheMode, CacheWriteSynchronizationMode syncMode, boolean near) {
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(cacheMode);
ccfg.setBackups(1);
ccfg.setNearConfiguration(near ? new NearCacheConfiguration() : null);
ccfg.setWriteSynchronizationMode(syncMode);
IgniteCache cache = ignite(0).createCache(ccfg);
if (near) {
for (int i = 0; i < NODES_CNT; i++) {
Ignite client = ignite(i + NODES_CNT);
assertTrue(client.configuration().isClientMode());
client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
}
}
return cache;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class TxPessimisticDeadlockDetectionTest method createCache.
/**
* @param cacheMode Cache mode.
* @param syncMode Write sync mode.
* @param near Near.
* @return Created cache.
*/
@SuppressWarnings("unchecked")
private IgniteCache createCache(CacheMode cacheMode, CacheWriteSynchronizationMode syncMode, boolean near) {
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(cacheMode);
ccfg.setBackups(1);
ccfg.setNearConfiguration(near ? new NearCacheConfiguration() : null);
ccfg.setWriteSynchronizationMode(syncMode);
if (cacheMode == LOCAL)
ccfg.setMemoryPolicyName("dfltPlc");
IgniteCache cache = ignite(0).createCache(ccfg);
if (near) {
for (int i = 0; i < NODES_CNT; i++) {
Ignite client = ignite(i + NODES_CNT);
assertTrue(client.configuration().isClientMode());
client.createNearCache(ccfg.getName(), new NearCacheConfiguration<>());
}
}
return cache;
}
Aggregations