当前位置: 首页>>代码示例>>Java>>正文


Java CacheConfiguration.setRebalanceMode方法代码示例

本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setRebalanceMode方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setRebalanceMode方法的具体用法?Java CacheConfiguration.setRebalanceMode怎么用?Java CacheConfiguration.setRebalanceMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.configuration.CacheConfiguration的用法示例。


在下文中一共展示了CacheConfiguration.setRebalanceMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cacheCfg.setCacheMode(getCacheMode());
    cacheCfg.setAtomicityMode(getAtomicMode());
    cacheCfg.setNearConfiguration(nearConfiguration());
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setRebalanceMode(SYNC);
    cacheCfg.setAffinityMapper(AFFINITY_MAPPER);

    cfg.setCacheConfiguration(cacheCfg);

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:GridCacheAbstractUsersAffinityMapperSelfTest.java

示例2: cacheCfg

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param name Cache name.
 * @return Cache configuration.
 */
private CacheConfiguration cacheCfg(String name) {
    CacheConfiguration<?, ?> cfg = new CacheConfiguration<>();

    cfg.setName(name);

    cfg.setRebalanceMode(CacheRebalanceMode.NONE);

    cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    cfg.setIndexedTypes(
            Integer.class, Country.class,
            Integer.class, Person.class
    );

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:IgnitePersistentStoreQueryWithMultipleClassesPerCacheTest.java

示例3: cache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @param cacheName Cache name.
 * @param backups Number of backups.
 * @return Configuration.
 */
@SuppressWarnings("unchecked")
private CacheConfiguration cache(String igniteInstanceName, String cacheName, int backups) {
    CacheConfiguration cacheCfg = new CacheConfiguration();

    cacheCfg.setName(cacheName);
    cacheCfg.setCacheMode(getCacheMode());
    cacheCfg.setAtomicityMode(getAtomicMode());
    cacheCfg.setNearConfiguration(nearConfiguration());
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);

    cacheCfg.setRebalanceMode(SYNC);

    cacheCfg.setCacheStoreFactory(new StoreFactory());

    cacheCfg.setWriteThrough(true);
    cacheCfg.setReadThrough(true);
    cacheCfg.setBackups(backups);

    return cacheCfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:GridCacheAbstractLocalStoreSelfTest.java

示例4: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration.
 */
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();

    // Template
    cc.setName("*");

    cc.setRebalanceMode(SYNC);

    cc.setCacheStoreFactory(singletonFactory(store));
    cc.setReadThrough(true);
    cc.setWriteThrough(true);
    cc.setLoadPreviousValue(true);
    cc.setStoreKeepBinary(true);

    cc.setCacheMode(cacheMode());
    cc.setWriteSynchronizationMode(cacheWriteSynchronizationMode());

    cc.setBackups(0);

    cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);

    return cc;
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:GridCacheStoreManagerDeserializationTest.java

示例5: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@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(PARTITIONED);
    cc.setBackups(1);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setRebalanceMode(SYNC);
    cc.setAffinity(new RendezvousAffinityFunction(false, 15));
    cc.setIndexedTypes(
        Integer.class, Integer.class
    );

    c.setCacheConfiguration(cc);

    return c;
}
 
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:IgniteCacheQueryNodeRestartSelfTest.java

示例6: geneCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * 
 * @return CacheConfiguration<Long, Gene>
 */
public static CacheConfiguration<Long, Gene> geneCache() {

    CacheConfiguration<Long, Gene> cfg = new CacheConfiguration<>(GAGridConstants.GENE_CACHE);
    cfg.setIndexedTypes(Long.class, Gene.class);
    cfg.setCacheMode(CacheMode.REPLICATED);
    cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cfg.setStatisticsEnabled(true);
    cfg.setBackups(1);
    cfg.setSqlFunctionClasses(GAGridFunction.class);
    return cfg;

}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:17,代码来源:GeneCacheConfig.java

示例7: populationCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * 
 * @return CacheConfiguration<Long, Chromosome>
 */
public static CacheConfiguration<Long, Chromosome> populationCache() {

    CacheConfiguration<Long, Chromosome> cfg = new CacheConfiguration<>(GAGridConstants.POPULATION_CACHE);
    cfg.setIndexedTypes(Long.class, Chromosome.class);
    cfg.setCacheMode(CacheMode.PARTITIONED);
    cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cfg.setStatisticsEnabled(true);
    cfg.setBackups(1);

    return cfg;

}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:18,代码来源:PopulationCacheConfig.java

示例8: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param backups Number of backups.
 * @param writeSync Cache write synchronization mode.
 * @return Cache configuration.
 */
private CacheConfiguration<Integer, Integer> cacheConfiguration(int backups,
    CacheWriteSynchronizationMode writeSync) {
    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();

    ccfg.setName(TEST_CACHE);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(writeSync);
    ccfg.setBackups(backups);
    ccfg.setRebalanceMode(ASYNC);

    return ccfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:IgniteCacheClientMultiNodeUpdateTopologyLockTest.java

示例9: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
    CacheConfiguration cc = super.cacheConfiguration(igniteInstanceName);

    cc.setRebalanceMode(SYNC);

    return cc;
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridCacheQueryInternalKeysSelfTest.java

示例10: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@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(PARTITIONED);

    // Query should be executed without ongoing transactions.
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setBackups(0);
    cc.setRebalanceMode(CacheRebalanceMode.SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setIndexedTypes(
        UUID.class, PersonObj.class
    );

    c.setCacheConfiguration(cc);

    return c;
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:IgniteCachePartitionedQueryMultiThreadedSelfTest.java

示例11: cacheConfig

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cacheMode Cache mode.
 * @param preloadOrder Preload order.
 * @param name Cache name.
 * @return Cache configuration.
 */
private CacheConfiguration cacheConfig(CacheMode cacheMode, int preloadOrder, String name) {
    CacheConfiguration cfg = defaultCacheConfiguration();

    cfg.setName(name);
    cfg.setCacheMode(cacheMode);
    cfg.setRebalanceOrder(preloadOrder);
    cfg.setRebalanceMode(ASYNC);
    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:GridCacheOrderedPreloadingSelfTest.java

示例12: checkLoadedValue

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
private void checkLoadedValue(int backups) throws Exception {
    CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
    cacheCfg.setCacheStoreFactory(new StoreFactory());
    cacheCfg.setReadThrough(true);
    cacheCfg.setBackups(backups);
    cacheCfg.setLoadPreviousValue(true);

    IgniteCache<Integer, Integer> cache = ignite(0).createCache(cacheCfg);

    for (int i = 0; i < 10; i++)
        assertEquals((Integer)i, cache.get(i));

    cache.removeAll();

    assertEquals(0, cache.size());

    for (TransactionConcurrency conc : TransactionConcurrency.values()) {
        for (TransactionIsolation iso : TransactionIsolation.values()) {
            info("Checking transaction [conc=" + conc + ", iso=" + iso + ']');

            try (Transaction tx = ignite(0).transactions().txStart(conc, iso)) {
                for (int i = 0; i < 10; i++)
                    assertEquals("Invalid value for transaction [conc=" + conc + ", iso=" + iso + ']',
                        (Integer)i, cache.get(i));

                tx.commit();
            }

            cache.removeAll();
            assertEquals(0, cache.size());
        }
    }

    cache.destroy();
}
 
开发者ID:apache,项目名称:ignite,代码行数:43,代码来源:GridCacheTxLoadFromStoreOnLockSelfTest.java

示例13: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(cacheMode());
    cacheCfg.setWriteSynchronizationMode(FULL_ASYNC);
    cacheCfg.setRebalanceMode(SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);

    return cacheCfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:GridCacheLockAbstractTest.java

示例14: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Gets cache configuration for grid with given name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setRebalanceBatchSize(preloadBatchSize);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(preloadMode);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cacheCfg.setBackups(backups);
    cacheCfg.setOnheapCacheEnabled(onheapCacheEnabled());

    return cacheCfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:GridCacheDhtPreloadSelfTest.java

示例15: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Cache configuration.
 */
public CacheConfiguration cacheConfiguration(String igniteInstanceName) {
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setCacheMode(cacheMode());
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setNearConfiguration(nearConfiguration());
    ccfg.setRebalanceMode(SYNC);

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

    return ccfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:IgniteTxConsistencyRestartAbstractSelfTest.java


注:本文中的org.apache.ignite.configuration.CacheConfiguration.setRebalanceMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。