Search in sources :

Example 51 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 52 with NearCacheConfiguration

use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.

the class CacheStoreReadFromBackupTest method cacheConfig.

/**
 */
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfig(String cacheName) {
    CacheConfiguration ccfg = new CacheConfiguration<>(cacheName);
    ccfg.setCacheMode(cacheMode);
    ccfg.setBackups(backups);
    ccfg.setAtomicityMode(atomicityMode());
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 1));
    ccfg.setReadThrough(true);
    ccfg.setReadFromBackup(true);
    ccfg.setCacheStoreFactory(FactoryBuilder.factoryOf(TestStore.class));
    if (near)
        ccfg.setNearConfiguration(new NearCacheConfiguration());
    return ccfg;
}
Also used : RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 53 with NearCacheConfiguration

use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.

the class GridProjectionForCachesSelfTest method cacheConfiguration.

/**
 * @param cacheName Cache name.
 * @return Cache configuration.
 */
private CacheConfiguration cacheConfiguration(@NotNull String cacheName, IgnitePredicate<ClusterNode> nodeFilter, boolean nearEnabled) {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setName(cacheName);
    cfg.setCacheMode(PARTITIONED);
    if (nearEnabled)
        cfg.setNearConfiguration(new NearCacheConfiguration());
    cfg.setNodeFilter(nodeFilter);
    cfg.setBackups(1);
    return cfg;
}
Also used : NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 54 with NearCacheConfiguration

use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.

the class GridCacheGetStoreErrorSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(cacheMode);
    if (nearEnabled)
        cc.setNearConfiguration(new NearCacheConfiguration());
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setCacheStoreFactory(new IgniteReflectionFactory<CacheStore>(TestStore.class));
    cc.setReadThrough(true);
    cc.setWriteThrough(true);
    cc.setLoadPreviousValue(true);
    c.setCacheConfiguration(cc);
    c.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) 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) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 55 with NearCacheConfiguration

use of org.apache.ignite.configuration.NearCacheConfiguration in project ignite by apache.

the class GridCacheNearEvictionSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setBackups(1);
    cc.setRebalanceMode(SYNC);
    cc.setAtomicityMode(atomicityMode());
    NearCacheConfiguration nearCfg = new NearCacheConfiguration();
    cc.setNearConfiguration(nearCfg);
    c.setCacheConfiguration(cc);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    return c;
}
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)

Aggregations

NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)158 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)121 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)50 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)41 Ignite (org.apache.ignite.Ignite)37 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)13 IgniteCache (org.apache.ignite.IgniteCache)12 CacheException (javax.cache.CacheException)11 IgniteEx (org.apache.ignite.internal.IgniteEx)9 Transaction (org.apache.ignite.transactions.Transaction)9 ArrayList (java.util.ArrayList)8 IgniteException (org.apache.ignite.IgniteException)8 HashMap (java.util.HashMap)7 FifoEvictionPolicy (org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy)7 LinkedHashMap (java.util.LinkedHashMap)6 Callable (java.util.concurrent.Callable)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)6 QuerySchema (org.apache.ignite.internal.processors.query.QuerySchema)6 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)6