Search in sources :

Example 41 with CacheConfiguration

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

the class GridCacheEntryVersionSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setBackups(1);
    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setCacheConfiguration(ccfg);
    cfg.setDiscoverySpi(discoSpi);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 42 with CacheConfiguration

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

the class GridCacheEvictionEventAbstractTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration c = super.getConfiguration();
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(atomicityMode());
    cc.setEvictionPolicy(new FifoEvictionPolicy());
    cc.setOnheapCacheEnabled(true);
    c.setCacheConfiguration(cc);
    c.setIncludeEventTypes(EVT_CACHE_ENTRY_EVICTED, EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FifoEvictionPolicy(org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 43 with CacheConfiguration

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

the class GridCacheIncrementTransformTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cache.setCacheMode(PARTITIONED);
    cache.setAtomicityMode(ATOMIC);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setBackups(1);
    cache.setRebalanceMode(SYNC);
    cfg.setCacheConfiguration(cache);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 44 with CacheConfiguration

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

the class GridCacheIteratorPerformanceTest method cacheConfiguration.

/**
 * @return Cache configuration.
 */
private CacheConfiguration cacheConfiguration() {
    CacheConfiguration cfg = defaultCacheConfiguration();
    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    return cfg;
}
Also used : CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 45 with CacheConfiguration

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

the class CacheConfigurationLeakTest method testCacheCreateLeak.

/**
 * @throws Exception If failed.
 */
public void testCacheCreateLeak() throws Exception {
    final Ignite ignite = grid();
    GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {

        @Override
        public void apply(Integer idx) {
            for (int i = 0; i < 100; i++) {
                CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
                ccfg.setName("cache-" + idx + "-" + i);
                ccfg.setEvictionPolicy(new LruEvictionPolicy(1000));
                ccfg.setOnheapCacheEnabled(true);
                IgniteCache<Object, Object> cache = ignite.createCache(ccfg);
                for (int k = 0; k < 5000; k++) cache.put(k, new byte[1024]);
                ignite.destroyCache(cache.getName());
            }
        }
    }, 5, "cache-thread");
}
Also used : IgniteCache(org.apache.ignite.IgniteCache) Ignite(org.apache.ignite.Ignite) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Aggregations

CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1234 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)474 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)330 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)292 Ignite (org.apache.ignite.Ignite)202 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)127 ArrayList (java.util.ArrayList)95 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)82 IgniteEx (org.apache.ignite.internal.IgniteEx)60 QueryEntity (org.apache.ignite.cache.QueryEntity)59 IgniteCache (org.apache.ignite.IgniteCache)55 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)54 CacheException (javax.cache.CacheException)51 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)51 IgniteException (org.apache.ignite.IgniteException)50 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)45 LinkedHashMap (java.util.LinkedHashMap)41 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)41 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)38 Transaction (org.apache.ignite.transactions.Transaction)35