use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class LruNearEvictionPolicySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
cc.setCacheMode(PARTITIONED);
cc.setAtomicityMode(atomicityMode);
cc.setWriteSynchronizationMode(PRIMARY_SYNC);
cc.setRebalanceMode(SYNC);
cc.setBackups(0);
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
LruEvictionPolicy plc = new LruEvictionPolicy();
plc.setMaxSize(EVICTION_MAX_SIZE);
nearCfg.setNearEvictionPolicy(plc);
cc.setNearConfiguration(nearCfg);
c.setCacheConfiguration(cc);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
return c;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class DataStreamProcessorSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "IfMayBeConditional", "unchecked" })
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setForceServerMode(true);
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
cfg.setIncludeProperties();
if (useCache) {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(mode);
cc.setAtomicityMode(TRANSACTIONAL);
if (nearEnabled) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
cc.setNearConfiguration(nearCfg);
}
cc.setWriteSynchronizationMode(FULL_SYNC);
if (store != null) {
cc.setCacheStoreFactory(new IgniteReflectionFactory<CacheStore>(TestStore.class));
cc.setReadThrough(true);
cc.setWriteThrough(true);
}
cfg.setCacheConfiguration(cc);
} else {
cfg.setCacheConfiguration();
cfg.setClientMode(true);
}
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class TxPessimisticDeadlockDetectionCrossCacheTest method getCache.
/**
* @param ignite Ignite.
* @param name Name.
* @param near Near.
*/
private IgniteCache<Integer, Integer> getCache(Ignite ignite, @NotNull String name, boolean near) {
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName(name);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(1);
ccfg.setNearConfiguration(near ? new NearCacheConfiguration() : null);
return ignite.getOrCreateCache(ccfg);
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class TxRollbackOnTimeoutTest method startClient.
/**
* @throws Exception If f nodeailed.
* @return Started client.
*/
private Ignite startClient() throws Exception {
Ignite client = startGrid("client");
assertTrue(client.configuration().isClientMode());
if (nearCacheEnabled())
client.createNearCache(CACHE_NAME, new NearCacheConfiguration<>());
else
assertNotNull(client.cache(CACHE_NAME));
return client;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class TxRollbackOnTimeoutTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());
boolean client = "client".equals(igniteInstanceName);
cfg.setClientMode(client);
if (!client) {
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
if (nearCacheEnabled())
ccfg.setNearConfiguration(new NearCacheConfiguration());
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setBackups(2);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
}
return cfg;
}
Aggregations