Search in sources :

Example 16 with NearCacheConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) CacheStoreAdapter(org.apache.ignite.cache.store.CacheStoreAdapter) CacheStore(org.apache.ignite.cache.store.CacheStore) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 17 with NearCacheConfiguration

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 18 with NearCacheConfiguration

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);
}
Also used : Ignite(org.apache.ignite.Ignite) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 19 with NearCacheConfiguration

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;
}
Also used : NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 20 with NearCacheConfiguration

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;
}
Also used : NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Aggregations

NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)140 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)110 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)45 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)38 Ignite (org.apache.ignite.Ignite)32 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)12 CacheException (javax.cache.CacheException)11 IgniteCache (org.apache.ignite.IgniteCache)11 IgniteEx (org.apache.ignite.internal.IgniteEx)9 IgniteException (org.apache.ignite.IgniteException)8 Transaction (org.apache.ignite.transactions.Transaction)8 FifoEvictionPolicy (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)7 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)6 HashMap (java.util.HashMap)5 LinkedHashMap (java.util.LinkedHashMap)5 Callable (java.util.concurrent.Callable)5 TimeoutException (java.util.concurrent.TimeoutException)5 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)5 ArrayList (java.util.ArrayList)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4