Search in sources :

Example 96 with NearCacheConfiguration

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

Example 97 with NearCacheConfiguration

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

Example 98 with NearCacheConfiguration

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;
}
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)

Example 99 with NearCacheConfiguration

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

Example 100 with NearCacheConfiguration

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