use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class GridCacheReloadSelfTest method getConfiguration.
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setLocalHost("127.0.0.1");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500"));
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(CACHE_NAME);
cacheCfg.setCacheMode(cacheMode);
LruEvictionPolicy plc = new LruEvictionPolicy();
plc.setMaxSize(MAX_CACHE_ENTRIES);
cacheCfg.setEvictionPolicy(plc);
cacheCfg.setOnheapCacheEnabled(true);
cacheCfg.setNearConfiguration(nearEnabled ? new NearCacheConfiguration() : null);
final CacheStore store = new CacheStoreAdapter<Integer, Integer>() {
@Override
public Integer load(Integer key) {
return key;
}
@Override
public void write(javax.cache.Cache.Entry<? extends Integer, ? extends Integer> e) {
//No-op.
}
@Override
public void delete(Object key) {
//No-op.
}
};
cacheCfg.setCacheStoreFactory(singletonFactory(store));
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
if (cacheMode == PARTITIONED)
cacheCfg.setBackups(1);
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class IgniteTxReentryAbstractSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setCommunicationSpi(new CountingCommunicationSpi());
cfg.setDiscoverySpi(discoSpi);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
if (nearEnabled())
cacheCfg.setNearConfiguration(new NearCacheConfiguration());
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class GridCacheJdbcBlobStoreMultithreadedSelfTest method beforeTest.
/** {@inheritDoc} */
@Override
protected void beforeTest() throws Exception {
startGridsMultiThreaded(GRID_CNT - 2);
client = true;
Ignite grid = startGrid(GRID_CNT - 2);
grid.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
grid = startGrid(GRID_CNT - 1);
grid.cache(DEFAULT_CACHE_NAME);
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class CacheStopAndDestroySelfTest method getNearConfig.
/**
* @return near config
*/
private CacheConfiguration getNearConfig() {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setName(CACHE_NAME_NEAR);
cfg.setCacheMode(PARTITIONED);
cfg.setNearConfiguration(new NearCacheConfiguration());
return cfg;
}
use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.
the class CacheStoreUsageMultinodeAbstractTest method cacheConfiguration.
/**
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(atomicityMode());
ccfg.setBackups(1);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
if (cacheStore) {
if (writeBehind) {
ccfg.setWriteBehindEnabled(true);
ccfg.setWriteBehindFlushFrequency(100);
}
ccfg.setWriteThrough(true);
ccfg.setCacheStoreFactory(locStore ? new TestLocalStoreFactory() : new TestStoreFactory());
}
if (nearCache)
ccfg.setNearConfiguration(new NearCacheConfiguration());
return ccfg;
}
Aggregations