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


Java CacheConfiguration.setPartitionLossPolicy方法代码示例

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


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

示例1: getConfiguration

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

    cfg.setActiveOnStart(false);

    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(CACHE_NAME);

    ccfg.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg.setBackups(2);

    cfg.setCacheConfiguration(ccfg);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024).setPersistenceEnabled(true))
        .setWalMode(WALMode.LOG_ONLY)
        .setCheckpointFrequency(CHECKPOINT_FREQUENCY);

    cfg.setDataStorageConfiguration(memCfg);

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

示例2: getConfiguration

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

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);

    cfg.setClientMode(client);

    CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(CACHE_NAME);

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setBackups(0);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setPartitionLossPolicy(partLossPlc);
    cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32));

    cfg.setCacheConfiguration(cacheCfg);

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

示例3: getConfiguration

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

    CacheConfiguration ccfg1 = cacheConfiguration(cacheName);
    ccfg1.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
    ccfg1.setBackups(1);
    ccfg1.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    CacheConfiguration ccfg2 = cacheConfiguration("indexed");
    ccfg2.setBackups(1);
    ccfg2.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    QueryEntity qryEntity = new QueryEntity(Integer.class.getName(), TestValue.class.getName());

    LinkedHashMap<String, String> fields = new LinkedHashMap<>();

    fields.put("v1", Integer.class.getName());
    fields.put("v2", Integer.class.getName());

    qryEntity.setFields(fields);

    QueryIndex qryIdx = new QueryIndex("v1", true);

    qryEntity.setIndexes(Collections.singleton(qryIdx));

    ccfg2.setQueryEntities(Collections.singleton(qryEntity));

    // Do not start filtered cache on coordinator.
    if (gridName.endsWith("0")) {
        cfg.setCacheConfiguration(ccfg1, ccfg2);
    }
    else {
        CacheConfiguration ccfg3 = cacheConfiguration("filtered");
        ccfg3.setPartitionLossPolicy(PartitionLossPolicy.READ_ONLY_SAFE);
        ccfg3.setBackups(1);
        ccfg3.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
        ccfg3.setNodeFilter(new CoordinatorNodeFilter());

        cfg.setCacheConfiguration(ccfg1, ccfg2, ccfg3);
    }

    DataStorageConfiguration memCfg = new DataStorageConfiguration();

    memCfg.setConcurrencyLevel(Runtime.getRuntime().availableProcessors() * 4);
    memCfg.setPageSize(1024);
    memCfg.setWalMode(WALMode.LOG_ONLY);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setMaxSize(150 * 1024 * 1024);
    memPlcCfg.setInitialSize(100 * 1024 * 1024);
    memPlcCfg.setSwapPath("work/swap");
    memPlcCfg.setPersistenceEnabled(true);

    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);

    cfg.setDataStorageConfiguration(memCfg);

    cfg.setDiscoverySpi(
        new TcpDiscoverySpi()
            .setIpFinder(IP_FINDER)
    );

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


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