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


Java CacheRebalanceMode类代码示例

本文整理汇总了Java中org.apache.ignite.cache.CacheRebalanceMode的典型用法代码示例。如果您正苦于以下问题:Java CacheRebalanceMode类的具体用法?Java CacheRebalanceMode怎么用?Java CacheRebalanceMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getConfiguration

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

    CacheConfiguration ccfg = new CacheConfiguration("abc");

    if (indexingEnabled())
        ccfg.setIndexedTypes(Integer.class, Abc.class);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);

    cfg.setCacheConfiguration(F.concat(cfg.getCacheConfiguration(), ccfg));

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

示例2: cacheCfg

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的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: getConfiguration

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    CacheConfiguration ccfg = defaultCacheConfiguration()
        .setCacheMode(CacheMode.PARTITIONED)
        .setAtomicityMode(CacheAtomicityMode.ATOMIC)
        .setRebalanceMode(CacheRebalanceMode.ASYNC)
        .setRebalanceBatchSize(1000)
        .setRebalanceDelay(0)
        .setName(PERSON_CACHE)
        .setIndexedTypes(Integer.class, Person.class);

    cfg.setCacheConfiguration(ccfg);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);

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

示例4: cacheConfiguration

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

    cacheCfg.setName(DEFAULT_CACHE_NAME);
    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);

    // Set atomicity mode.
    CacheAtomicityMode atomicityMode = enumProperty(PROP_ATOMICITY_MODE, CacheAtomicityMode.class);

    if (atomicityMode != null)
        cacheCfg.setAtomicityMode(atomicityMode);

    // Set write synchronization mode.
    CacheWriteSynchronizationMode writeSyncMode =
        enumProperty(PROP_WRITE_SYNC_MODE, CacheWriteSynchronizationMode.class);

    if (writeSyncMode != null)
        cacheCfg.setWriteSynchronizationMode(writeSyncMode);

    // Set backups.
    cacheCfg.setBackups(intProperty(PROP_BACKUPS));

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

示例5: validatePreloadOrder

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的package包/类
/**
 * Checks that preload-order-dependant caches has SYNC or ASYNC preloading mode.
 *
 * @param cfgs Caches.
 * @return Maximum detected preload order.
 * @throws IgniteCheckedException If validation failed.
 */
private int validatePreloadOrder(CacheConfiguration[] cfgs) throws IgniteCheckedException {
    int maxOrder = 0;

    for (CacheConfiguration cfg : cfgs) {
        int rebalanceOrder = cfg.getRebalanceOrder();

        if (rebalanceOrder > 0) {
            if (cfg.getCacheMode() == LOCAL)
                throw new IgniteCheckedException("Rebalance order set for local cache (fix configuration and restart the " +
                    "node): " + U.maskName(cfg.getName()));

            if (cfg.getRebalanceMode() == CacheRebalanceMode.NONE)
                throw new IgniteCheckedException("Only caches with SYNC or ASYNC rebalance mode can be set as rebalance " +
                    "dependency for other caches [cacheName=" + U.maskName(cfg.getName()) +
                    ", rebalanceMode=" + cfg.getRebalanceMode() + ", rebalanceOrder=" + cfg.getRebalanceOrder() + ']');

            maxOrder = Math.max(maxOrder, rebalanceOrder);
        }
        else if (rebalanceOrder < 0)
            throw new IgniteCheckedException("Rebalance order cannot be negative for cache (fix configuration and restart " +
                "the node) [cacheName=" + cfg.getName() + ", rebalanceOrder=" + rebalanceOrder + ']');
    }

    return maxOrder;
}
 
开发者ID:apache,项目名称:ignite,代码行数:33,代码来源:GridCacheProcessor.java

示例6: cacheConfiguration

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的package包/类
/** {@inheritDoc} */
protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setName(cacheName);

    if ("meta".equals(cacheName))
        cacheCfg.setCacheMode(REPLICATED);
    else {
        cacheCfg.setCacheMode(PARTITIONED);
        cacheCfg.setNearConfiguration(null);
        cacheCfg.setBackups(0);
        cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(CFG_GRP_SIZE));
    }

    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);

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

示例7: getConfiguration

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

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME)
        .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
        .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
        .setAffinity(new RendezvousAffinityFunction(false, 128))
        .setRebalanceMode(CacheRebalanceMode.SYNC)
        .setBackups(1);

    cfg.setCacheConfiguration(ccfg);

    // Intentionally set small page cache size.
    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(70 * 1024 * 1024).setPersistenceEnabled(true))
        .setWalMode(WALMode.LOG_ONLY);

    cfg.setDataStorageConfiguration(memCfg);

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

示例8: getConfiguration

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

    CacheConfiguration ccfg = new CacheConfiguration(cacheName);

    ccfg.setRebalanceMode(CacheRebalanceMode.NONE);

    cfg.setCacheConfiguration(ccfg);

    cfg.setDataStorageConfiguration(
        new DataStorageConfiguration()
            .setCheckpointFrequency(500)
            .setWalMode(WALMode.LOG_ONLY)
            .setAlwaysWriteFullPages(true)
            .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))
    );

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

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

示例9: getConfiguration

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

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setBackups(2);
    cc.setRebalanceMode(CacheRebalanceMode.SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);

    c.setCacheConfiguration(cc);

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

示例10: getConfiguration

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

    CacheConfiguration<Integer, TestObject> 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.setLoadPreviousValue(true);

    cfg.setCacheConfiguration(cacheCfg);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(disco);

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

示例11: getConfiguration

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

    if (hasCache) {
        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

        ccfg.setCacheMode(CacheMode.PARTITIONED);
        ccfg.setBackups(1);
        ccfg.setName(CACHE_NAME);
        ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
        ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);

        cfg.setCacheConfiguration(ccfg);
    }

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

示例12: geneCache

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的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

示例13: populationCache

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的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

示例14: getConfiguration

import org.apache.ignite.cache.CacheRebalanceMode; //导入依赖的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

示例15: getConfiguration

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

    cfg.setClientMode(clientMode);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    discoSpi.setForceServerMode(true);
    cfg.setDiscoverySpi(discoSpi);

    cfg.setCommunicationSpi(commSpiFactory.create());

    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setCacheMode(cacheMode);
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setBackups(backups);

    if (syncRebalance)
        ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);

    ccfg.setNearConfiguration(null);

    cfg.setCacheConfiguration(ccfg);

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


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