Search in sources :

Example 31 with NearCacheConfiguration

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;
}
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) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 32 with NearCacheConfiguration

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;
}
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 33 with NearCacheConfiguration

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

Example 34 with NearCacheConfiguration

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

Example 35 with NearCacheConfiguration

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

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