org.apache.ignite.cache.CacheMode Java Examples

The following examples show how to use org.apache.ignite.cache.CacheMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheResultIsNotNullOnPartitionLossTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setActiveOnStart(false);
    cfg.setIncludeEventTypes(EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);

    cfg.setCacheConfiguration(
        new CacheConfiguration<>(DEFAULT_CACHE_NAME)
            .setCacheMode(CacheMode.PARTITIONED)
            .setBackups(0)
            .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
            .setAffinity(new RendezvousAffinityFunction(false, 50))
            .setPartitionLossPolicy(PartitionLossPolicy.READ_WRITE_SAFE)
    );

    return cfg;
}
 
Example #2
Source File: TxRecoveryStoreEnabledTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setCommunicationSpi(new TestCommunicationSpi());

    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName(CACHE_NAME);
    ccfg.setNearConfiguration(null);
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setBackups(1);
    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setCacheStoreFactory(new TestCacheStoreFactory());
    ccfg.setReadThrough(true);
    ccfg.setWriteThrough(true);
    ccfg.setWriteBehindEnabled(false);

    cfg.setCacheConfiguration(ccfg);

    cfg.setFailureHandler(new StopNodeFailureHandler());

    return cfg;
}
 
Example #3
Source File: AbstractContinuousQueryRemoteSecurityContextCheckTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Opens query cursor.
 *
 * @param q {@link Query}.
 * @param init True if needing put data to a cache before openning a cursor.
 */
protected void executeQuery(Query<Cache.Entry<Integer, Integer>> q, boolean init) {
    Ignite ignite = localIgnite();

    IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(
        new CacheConfiguration<Integer, Integer>()
            .setName(CACHE_NAME + CACHE_INDEX.incrementAndGet())
            .setCacheMode(CacheMode.PARTITIONED)
    );

    if (init)
        cache.put(primaryKey(grid(SRV_CHECK), cache.getName()), 100);

    try (QueryCursor<Cache.Entry<Integer, Integer>> cur = cache.query(q)) {
        if (!init)
            cache.put(primaryKey(grid(SRV_CHECK), cache.getName()), 100);

        cur.getAll();
    }
}
 
Example #4
Source File: GridCacheDhtPreloadMultiThreadedSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = loadConfiguration("modules/core/src/test/config/spring-multicache.xml");

    cfg.setGridLogger(getTestResources().getLogger());

    cfg.setIgniteInstanceName(igniteInstanceName);

    cfg.setFailureHandler(new NoOpFailureHandler());

    for (CacheConfiguration cCfg : cfg.getCacheConfiguration()) {
        if (cCfg.getCacheMode() == CacheMode.PARTITIONED) {
            cCfg.setAffinity(new RendezvousAffinityFunction(2048, null));
            cCfg.setBackups(1);
        }
    }

    return cfg;
}
 
Example #5
Source File: GridCacheReferenceCleanupSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** @throws Exception If failed. */
@Test
public void testOneAsyncOpPartitioned() throws Exception {
    mode = CacheMode.PARTITIONED;

    startGrids(2);

    try {
        checkReferenceCleanup(oneAsyncOpCallable());
    }
    finally {
        stopAllGrids();
    }
}
 
Example #6
Source File: LocalCacheTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Updates the given ignite configuration and specifies a local cache with persistence enabled.
 *
 * @param cfg Ignite configuration to be updated.
 * @param consistentId Consistent id.
 * @return Updated configuration.
 */
private static IgniteConfiguration prepareConfig(IgniteConfiguration cfg, @Nullable String consistentId) {
    cfg.setLocalHost("127.0.0.1");

    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(GridCacheAbstractFullApiSelfTest.LOCAL_IP_FINDER);

    cfg.setDiscoverySpi(disco);

    cfg.setPeerClassLoadingEnabled(false);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setPersistenceEnabled(true)
                .setInitialSize(10L * 1024 * 1024)
                .setMaxSize(10L * 1024 * 1024))
        .setPageSize(4096);

    cfg.setDataStorageConfiguration(memCfg);

    if (consistentId != null) {
        cfg.setIgniteInstanceName(consistentId);
        cfg.setConsistentId(consistentId);
    }

    CacheConfiguration<Object, Object> locCacheCfg = new CacheConfiguration<>("test-local-cache");
    locCacheCfg.setCacheMode(CacheMode.LOCAL);
    cfg.setCacheConfiguration(locCacheCfg);

    return cfg;
}
 
Example #7
Source File: GridCacheContinuousQueryConcurrentTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param cacheMode Cache mode.
 * @param atomicMode Atomicy mode.
 * @param backups Backups.
 * @return Cache configuration.
 */
private CacheConfiguration<Integer, String> cacheConfiguration(CacheMode cacheMode,
    CacheAtomicityMode atomicMode, int backups) {
    CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>("test-" + cacheMode + atomicMode + backups);

    cfg.setCacheMode(cacheMode);
    cfg.setAtomicityMode(atomicMode);
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cfg.setBackups(backups);
    cfg.setReadFromBackup(false);

    return cfg;
}
 
Example #8
Source File: CacheScanPartitionQueryFallbackSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Scan (with explicit {@code setLocal(true)}) should perform on the local node.
 *
 * @throws Exception If failed.
 */
@Test
public void testScanLocalExplicit() throws Exception {
    cacheMode = CacheMode.PARTITIONED;
    backups = 0;
    commSpiFactory = new TestLocalCommunicationSpiFactory();

    try {
        Ignite ignite = startGrids(GRID_CNT);

        IgniteCacheProxy<Integer, Integer> cache = fillCache(ignite);

        int part = anyLocalPartition(cache.context());

        QueryCursor<Cache.Entry<Integer, Integer>> qry =
            cache.query(new ScanQuery<Integer, Integer>().setPartition(part).setLocal(true));

        doTestScanQuery(qry, part);

        GridTestUtils.assertThrows(log, (Callable<Void>)() -> {
            int remPart = remotePartition(cache.context()).getKey();

            cache.query(new ScanQuery<Integer, Integer>().setPartition(remPart).setLocal(true));

            return null;
        }, IgniteCheckedException.class, null);
    }
    finally {
        stopAllGrids();
    }
}
 
Example #9
Source File: WalModeChangeCommonAbstractSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Create cache configuration.
 *
 * @param name Name.
 * @param mode Mode.
 * @param atomicityMode Atomicity mode.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfig(String name, CacheMode mode, CacheAtomicityMode atomicityMode) {
    CacheConfiguration ccfg = new CacheConfiguration();

    ccfg.setName(name);
    ccfg.setCacheMode(mode);
    ccfg.setAtomicityMode(atomicityMode);

    ccfg.setNodeFilter(FILTER);

    return ccfg;
}
 
Example #10
Source File: CacheMvccProcessorLazyStartTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testMvccStartedWithDynamicCache() throws Exception {
    IgniteEx node1 = startGrid(1);
    IgniteEx node2 = startGrid(2);

    assertFalse(mvccEnabled(node1));
    assertFalse(mvccEnabled(node2));

    CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1);

    IgniteCache cache = node1.createCache(ccfg);

    cache.put(1, 1);
    cache.put(1, 2);

    assertTrue(mvccEnabled(node1));
    assertTrue(mvccEnabled(node2));

    stopGrid(1);
    stopGrid(2);

    node1 = startGrid(1);
    node2 = startGrid(2);

    // Should not be started because we do not have persistence enabled
    assertFalse(mvccEnabled(node1));
    assertFalse(mvccEnabled(node2));

    cache = node1.createCache(ccfg);

    cache.put(1, 1);
    cache.put(1, 2);

    assertTrue(mvccEnabled(node1));
    assertTrue(mvccEnabled(node2));
}
 
Example #11
Source File: CacheTxNotAllowReadFromBackupTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testBackupConsistencyPartitioned() throws Exception {
    CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>("test-cache");

    cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
    cfg.setCacheMode(CacheMode.PARTITIONED);
    cfg.setBackups(NODES - 1);
    cfg.setReadFromBackup(false);

    checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED);
    checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
    checkBackupConsistency(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE);

    checkBackupConsistency(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED);
    checkBackupConsistency(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ);
    checkBackupConsistency(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE);

    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED);
    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ);
    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE);

    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED);
    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ);
    checkBackupConsistencyGetAll(cfg, TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE);
}
 
Example #12
Source File: LocalAffinityFunctionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setBackups(1);
    ccfg.setName(CACHE1);
    ccfg.setCacheMode(CacheMode.LOCAL);
    ccfg.setAffinity(new RendezvousAffinityFunction());
    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
Example #13
Source File: IgniteSqlQueryParallelismTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param name Cache name.
 * @param idxTypes Indexed types.
 * @return Cache configuration.
 */
private static CacheConfiguration cacheConfig(String name, Class<?>... idxTypes) {
    return new CacheConfiguration()
        .setName(name)
        .setCacheMode(CacheMode.PARTITIONED)
        .setAtomicityMode(CacheAtomicityMode.ATOMIC)
        .setBackups(1)
        .setIndexedTypes(idxTypes);
}
 
Example #14
Source File: IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Test cache configuration.
 */
public CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.ENTRY_LOCK);

    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setBackups(backups);
    ccfg.setNearConfiguration(null);
    ccfg.setCacheMode(CacheMode.PARTITIONED);

    ccfg.setRebalanceDelay(-1);

    return ccfg;
}
 
Example #15
Source File: IgniteCacheEntryListenerExpiredEventsTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param cacheMode Cache mode.
 * @param atomicityMode Cache atomicity mode.
 * @return Cache configuration.
 */
private CacheConfiguration<Object, Object> cacheConfiguration(
    CacheMode cacheMode,
    CacheAtomicityMode atomicityMode) {
    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setAtomicityMode(atomicityMode);
    ccfg.setCacheMode(cacheMode);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

    if (cacheMode == PARTITIONED)
        ccfg.setBackups(1);

    return ccfg;
}
 
Example #16
Source File: H2CompareBigQueryTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    cfg.setCacheConfiguration(
        cacheConfiguration("custord", CacheMode.PARTITIONED, Integer.class, CustOrder.class),
        cacheConfiguration("replord", CacheMode.PARTITIONED, useColocatedData() ? AffinityKey.class : Integer.class, ReplaceOrder.class),
        cacheConfiguration("ordparam", CacheMode.PARTITIONED, useColocatedData() ? AffinityKey.class : Integer.class, OrderParams.class),
        cacheConfiguration("cancel", CacheMode.PARTITIONED, useColocatedData() ? AffinityKey.class : Integer.class, Cancel.class),
        cacheConfiguration("exec", CacheMode.REPLICATED, useColocatedData() ? AffinityKey.class : Integer.class, Exec.class));

    return cfg;
}
 
Example #17
Source File: AbstractSnapshotSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param ccfg Default cache configuration.
 * @return Cache configuration.
 */
protected static <K, V> CacheConfiguration<K, V> txCacheConfig(CacheConfiguration<K, V> ccfg) {
    return ccfg.setCacheMode(CacheMode.PARTITIONED)
        .setBackups(2)
        .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
        .setAffinity(new RendezvousAffinityFunction(false, CACHE_PARTS_COUNT));
}
 
Example #18
Source File: CacheClientsConcurrentStartTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
private CacheConfiguration cacheConfiguration(String cacheName) {
    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName(cacheName);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setBackups(2);
    ccfg.setNearConfiguration(null);
    ccfg.setAtomicityMode(TRANSACTIONAL);

    return ccfg;
}
 
Example #19
Source File: ThinClientSecurityContextOnRemoteNodeTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheConfiguration[] cacheConfigurations() {
    return new CacheConfiguration[] {
        new CacheConfiguration().setName(CACHE).setCacheMode(CacheMode.REPLICATED),
        new CacheConfiguration().setName(FORBIDDEN_CACHE).setCacheMode(CacheMode.REPLICATED)
    };
}
 
Example #20
Source File: JettyRestProcessorAbstractSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param cacheName Cache name to create.
 * @param mode Expected cache mode.
 * @param backups Expected number of backups.
 * @param wrtSync Expected cache write synchronization mode.
 * @param params Optional cache params.
 */
private void checkGetOrCreateAndDestroy(
    String cacheName,
    CacheMode mode,
    int backups,
    CacheWriteSynchronizationMode wrtSync,
    String cacheGrp,
    String dataRegion,
    String... params
) throws Exception {
    String ret = content(cacheName, GridRestCommand.GET_OR_CREATE_CACHE, params);

    info("GetOrCreateCache command result: " + ret);

    validateJsonResponse(ret);

    IgniteCache<String, String> cache = grid(0).cache(cacheName);

    cache.put("1", "1");

    CacheConfiguration ccfg = cache.getConfiguration(CacheConfiguration.class);

    assertEquals(backups, ccfg.getBackups());
    assertEquals(mode, ccfg.getCacheMode());
    assertEquals(wrtSync, ccfg.getWriteSynchronizationMode());

    if (!F.isEmpty(cacheGrp))
        assertEquals(cacheGrp, ccfg.getGroupName());

    if (!F.isEmpty(dataRegion))
        assertEquals(dataRegion, ccfg.getDataRegionName());

    ret = content(cacheName, GridRestCommand.DESTROY_CACHE);

    assertTrue(validateJsonResponse(ret).isNull());
    assertNull(grid(0).cache(cacheName));
}
 
Example #21
Source File: IgniteCacheQueryIndexSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return PARTITIONED;
}
 
Example #22
Source File: CacheMvccBasicContinuousQueryTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception  If failed.
 */
@Test
public void testUpdateCountersGapClosedReplicated() throws Exception {
    checkUpdateCountersGapsClosed(CacheMode.REPLICATED);
}
 
Example #23
Source File: GridReplicatedCacheJtaLookupClassNameSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return REPLICATED;
}
 
Example #24
Source File: PageEvictionTouchOrderTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Ignore("https://issues.apache.org/jira/browse/IGNITE-7956,https://issues.apache.org/jira/browse/IGNITE-9530")
@Test
public void testTouchOrderWithFairFifoEvictionMvccTxLocal() throws Exception {
    testTouchOrderWithFairFifoEviction(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT, CacheMode.LOCAL);
}
 
Example #25
Source File: IgniteCacheAtomicExpiryPolicyTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return PARTITIONED;
}
 
Example #26
Source File: IgniteBinaryObjectFieldsQuerySelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testFieldsQueryPartitionedTransactional() throws Exception {
    checkFieldsQuery(CacheMode.PARTITIONED, CacheAtomicityMode.TRANSACTIONAL);
}
 
Example #27
Source File: GridCacheReplicatedTxPessimisticOriginatingNodeFailureSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return REPLICATED;
}
 
Example #28
Source File: CacheClientBinaryQueryExample.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Executes example.
 *
 * @param args Command line arguments, none required.
 */
public static void main(String[] args) {
    try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) {
        System.out.println();
        System.out.println(">>> Binary objects cache query example started.");

        CacheConfiguration<Integer, Organization> orgCacheCfg = new CacheConfiguration<>();

        orgCacheCfg.setCacheMode(CacheMode.PARTITIONED);
        orgCacheCfg.setName(ORGANIZATION_CACHE_NAME);

        orgCacheCfg.setQueryEntities(Arrays.asList(createOrganizationQueryEntity()));

        CacheConfiguration<EmployeeKey, Employee> employeeCacheCfg = new CacheConfiguration<>();

        employeeCacheCfg.setCacheMode(CacheMode.PARTITIONED);
        employeeCacheCfg.setName(EMPLOYEE_CACHE_NAME);

        employeeCacheCfg.setQueryEntities(Arrays.asList(createEmployeeQueryEntity()));

        employeeCacheCfg.setKeyConfiguration(new CacheKeyConfiguration(EmployeeKey.class));

        try (IgniteCache<Integer, Organization> orgCache = ignite.getOrCreateCache(orgCacheCfg);
             IgniteCache<EmployeeKey, Employee> employeeCache = ignite.getOrCreateCache(employeeCacheCfg)
        ) {
            if (ignite.cluster().forDataNodes(orgCache.getName()).nodes().isEmpty()) {
                System.out.println();
                System.out.println(">>> This example requires remote cache nodes to be started.");
                System.out.println(">>> Please start at least 1 remote cache node.");
                System.out.println(">>> Refer to example's javadoc for details on configuration.");
                System.out.println();

                return;
            }

            // Populate cache with sample data entries.
            populateCache(orgCache, employeeCache);

            // Get cache that will work with binary objects.
            IgniteCache<BinaryObject, BinaryObject> binaryCache = employeeCache.withKeepBinary();

            // Run SQL fields query example.
            sqlFieldsQuery(binaryCache);

            // Run SQL query with join example.
            sqlJoinQuery(binaryCache);

            // Run full text query example.
            textQuery(binaryCache);

            System.out.println();
        }
        finally {
            // Delete caches with their content completely.
            ignite.destroyCache(ORGANIZATION_CACHE_NAME);
            ignite.destroyCache(EMPLOYEE_CACHE_NAME);
        }
    }
}
 
Example #29
Source File: GridCacheDhtPreloadPerformanceTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(
        CacheMode.PARTITIONED);
    cc.setWriteSynchronizationMode(
        CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(
        CacheRebalanceMode.SYNC);
    cc.setAffinity(new RendezvousAffinityFunction(false, 1300));
    cc.setBackups(2);

    CacheConfiguration cc1 = defaultCacheConfiguration();

    cc1.setName("cc1");
    cc1.setCacheMode(
        CacheMode.PARTITIONED);
    cc1.setWriteSynchronizationMode(
        CacheWriteSynchronizationMode.FULL_SYNC);
    cc1.setRebalanceMode(
        CacheRebalanceMode.SYNC);
    cc1.setAffinity(
        new RendezvousAffinityFunction(
            false,
            1300));
    cc1.setBackups(2);

    c.setIgfsThreadPoolSize(1);
    c.setSystemThreadPoolSize(2);
    c.setPublicThreadPoolSize(2);
    c.setManagementThreadPoolSize(1);
    c.setUtilityCachePoolSize(2);
    c.setPeerClassLoadingThreadPoolSize(1);

    c.setCacheConfiguration(cc, cc1);

    TcpCommunicationSpi comm = new TcpCommunicationSpi();

    comm.setSharedMemoryPort(-1);

    c.setCommunicationSpi(comm);

    return c;
}
 
Example #30
Source File: IgniteCacheReplicatedFieldsQuerySelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return REPLICATED;
}