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


Java CacheMode.REPLICATED属性代码示例

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


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

示例1: createCache

/**
 * Creates new cache configuration.
 *
 * @param name Cache name.
 * @param mode Cache mode.
 * @param clsK Key class.
 * @param clsV Value class.
 * @return Cache configuration.
 */
private static CacheConfiguration createCache(String name, CacheMode mode, Class<?> clsK, Class<?> clsV) {
    CacheConfiguration<?,?> cc = defaultCacheConfiguration();

    cc.setName(name);
    cc.setCacheMode(mode);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setRebalanceMode(SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setIndexedTypes(clsK, clsV);

    if ((mode != CacheMode.PARTITIONED) && (mode != CacheMode.REPLICATED))
        throw new IllegalStateException("mode: " + mode);

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

示例2: testOneAsyncOpReplicated

/** @throws Exception If failed. */
public void testOneAsyncOpReplicated() throws Exception {
    mode = CacheMode.REPLICATED;

    startGrids(2);

    try {
        checkReferenceCleanup(oneAsyncOpCallable());
    }
    finally {
        stopAllGrids();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:GridCacheReferenceCleanupSelfTest.java

示例3: testAsyncOpsAsyncCommitReplicated

/** @throws Exception If failed. */
public void testAsyncOpsAsyncCommitReplicated() throws Exception {
    mode = CacheMode.REPLICATED;

    startGrids(2);

    try {
        checkReferenceCleanup(asyncOpsAsyncCommitCallable());
    }
    finally {
        stopAllGrids();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:GridCacheReferenceCleanupSelfTest.java

示例4: testMisses

/**
 * @throws Exception If failed.
 */
public void testMisses() throws Exception {
    IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);

    int keyCnt = keyCount();

    int expReads = 0;

    // Get a few keys missed keys.
    for (int i = 0; i < keyCnt; i++) {
        assertNull("Value is not null for key: " + i, cache.get(i));

        if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() == CacheMode.REPLICATED ||
            affinity(cache).isPrimary(grid(0).localNode(), i))
            expReads++;
        else
            expReads += 2;
    }

    // Check metrics for the whole cache.
    long puts = 0;
    long reads = 0;
    long hits = 0;
    long misses = 0;

    for (int i = 0; i < gridCount(); i++) {
        CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();

        puts += m.getCachePuts();
        reads += m.getCacheGets();
        hits += m.getCacheHits();
        misses += m.getCacheMisses();
    }

    assertEquals(0, puts);
    assertEquals(expReads, reads);
    assertEquals(0, hits);
    assertEquals(expReads, misses);
}
 
开发者ID:apache,项目名称:ignite,代码行数:41,代码来源:GridCacheAbstractMetricsSelfTest.java

示例5: testSyncOpAsyncCommitReplicated

/** @throws Exception If failed. */
public void testSyncOpAsyncCommitReplicated() throws Exception {
    mode = CacheMode.REPLICATED;

    startGrids(2);

    try {
        checkReferenceCleanup(syncOpAsyncCommitCallable());
    }
    finally {
        stopAllGrids();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:GridCacheReferenceCleanupSelfTest.java

示例6: testCachePreload8

/**
 * @throws Exception If failed.
 */
public void testCachePreload8() throws Exception {
    sameGrp = false;
    cacheMode = CacheMode.REPLICATED;
    atomicityMode = CacheAtomicityMode.TRANSACTIONAL;

    cachePreloadTest();
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:CacheGroupsPreloadTest.java

示例7: H2DynamicIndexingComplexServerAtomicReplicatedTest

/**
 * Constructor.
 */
public H2DynamicIndexingComplexServerAtomicReplicatedTest() {
    super(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, 1, SRV_IDX);
}
 
开发者ID:apache,项目名称:ignite,代码行数:6,代码来源:H2DynamicIndexingComplexServerAtomicReplicatedTest.java

示例8: DynamicColumnsConcurrentTransactionalReplicatedSelfTest

/**
 * Constructor.
 */
public DynamicColumnsConcurrentTransactionalReplicatedSelfTest() {
    super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL);
}
 
开发者ID:apache,项目名称:ignite,代码行数:6,代码来源:DynamicColumnsConcurrentTransactionalReplicatedSelfTest.java

示例9: DynamicIndexReplicatedTransactionalConcurrentSelfTest

/**
 * Constructor.
 */
public DynamicIndexReplicatedTransactionalConcurrentSelfTest() {
    super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL);
}
 
开发者ID:apache,项目名称:ignite,代码行数:6,代码来源:DynamicIndexReplicatedTransactionalConcurrentSelfTest.java

示例10: getCacheMode

/** {@inheritDoc} */
@Override protected CacheMode getCacheMode() {
    return CacheMode.REPLICATED;
}
 
开发者ID:apache,项目名称:ignite,代码行数:4,代码来源:GridCacheReplicatedUsersAffinityMapperSelfTest.java

示例11: H2DynamicIndexingComplexClientTransactionalReplicatedTest

/**
 * Constructor.
 */
public H2DynamicIndexingComplexClientTransactionalReplicatedTest() {
    super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, 1, CLIENT_IDX);
}
 
开发者ID:apache,项目名称:ignite,代码行数:6,代码来源:H2DynamicIndexingComplexClientTransactionalReplicatedTest.java

示例12: cacheMode

/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
    return CacheMode.REPLICATED;
}
 
开发者ID:apache,项目名称:ignite,代码行数:4,代码来源:CacheVersionedEntryReplicatedTransactionalSelfTest.java

示例13: isReplicated

/**
 * @return {@code True} if cache is replicated cache.
 */
public boolean isReplicated() {
    return cacheCfg.getCacheMode() == CacheMode.REPLICATED;
}
 
开发者ID:apache,项目名称:ignite,代码行数:6,代码来源:GridCacheContext.java

示例14: run

/** {@inheritDoc} */
@Override protected VisorCachePartitions run(VisorCachePartitionsTaskArg arg) throws IgniteException {
    String cacheName = arg.getCacheName();

    if (debug)
        log(ignite.log(), "Collecting partitions for cache: " + escapeName(cacheName));

    VisorCachePartitions parts = new VisorCachePartitions();

    GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);

    // Cache was not started.
    if (ca == null || !ca.context().started())
        return parts;

    CacheConfiguration cfg = ca.configuration();

    CacheMode mode = cfg.getCacheMode();

    boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED)
        && ca.context().affinityNode();

    if (partitioned) {
        GridDhtCacheAdapter dca = null;

        if (ca instanceof GridNearCacheAdapter)
            dca = ((GridNearCacheAdapter)ca).dht();
        else if (ca instanceof GridDhtCacheAdapter)
            dca = (GridDhtCacheAdapter)ca;

        if (dca != null) {
            GridDhtPartitionTopology top = dca.topology();

            List<GridDhtLocalPartition> locParts = top.localPartitions();

            for (GridDhtLocalPartition part : locParts) {
                int p = part.id();

                long sz = part.dataStore().cacheSize(ca.context().cacheId());

                // Pass NONE as topology version in order not to wait for topology version.
                if (part.primary(AffinityTopologyVersion.NONE))
                    parts.addPrimary(p, sz);
                else if (part.state() == GridDhtPartitionState.OWNING && part.backup(AffinityTopologyVersion.NONE))
                    parts.addBackup(p, sz);
            }
        }
    }

    return parts;
}
 
开发者ID:apache,项目名称:ignite,代码行数:51,代码来源:VisorCachePartitionsTask.java

示例15: testCachePreload3

/**
 * @throws Exception If failed.
 */
public void testCachePreload3() throws Exception {
    cacheMode = CacheMode.REPLICATED;

    cachePreloadTest();
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:CacheGroupsPreloadTest.java


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