本文整理汇总了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;
}
示例2: testOneAsyncOpReplicated
/** @throws Exception If failed. */
public void testOneAsyncOpReplicated() throws Exception {
mode = CacheMode.REPLICATED;
startGrids(2);
try {
checkReferenceCleanup(oneAsyncOpCallable());
}
finally {
stopAllGrids();
}
}
示例3: testAsyncOpsAsyncCommitReplicated
/** @throws Exception If failed. */
public void testAsyncOpsAsyncCommitReplicated() throws Exception {
mode = CacheMode.REPLICATED;
startGrids(2);
try {
checkReferenceCleanup(asyncOpsAsyncCommitCallable());
}
finally {
stopAllGrids();
}
}
示例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);
}
示例5: testSyncOpAsyncCommitReplicated
/** @throws Exception If failed. */
public void testSyncOpAsyncCommitReplicated() throws Exception {
mode = CacheMode.REPLICATED;
startGrids(2);
try {
checkReferenceCleanup(syncOpAsyncCommitCallable());
}
finally {
stopAllGrids();
}
}
示例6: testCachePreload8
/**
* @throws Exception If failed.
*/
public void testCachePreload8() throws Exception {
sameGrp = false;
cacheMode = CacheMode.REPLICATED;
atomicityMode = CacheAtomicityMode.TRANSACTIONAL;
cachePreloadTest();
}
示例7: H2DynamicIndexingComplexServerAtomicReplicatedTest
/**
* Constructor.
*/
public H2DynamicIndexingComplexServerAtomicReplicatedTest() {
super(CacheMode.REPLICATED, CacheAtomicityMode.ATOMIC, 1, SRV_IDX);
}
示例8: DynamicColumnsConcurrentTransactionalReplicatedSelfTest
/**
* Constructor.
*/
public DynamicColumnsConcurrentTransactionalReplicatedSelfTest() {
super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL);
}
示例9: DynamicIndexReplicatedTransactionalConcurrentSelfTest
/**
* Constructor.
*/
public DynamicIndexReplicatedTransactionalConcurrentSelfTest() {
super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL);
}
示例10: getCacheMode
/** {@inheritDoc} */
@Override protected CacheMode getCacheMode() {
return CacheMode.REPLICATED;
}
示例11: H2DynamicIndexingComplexClientTransactionalReplicatedTest
/**
* Constructor.
*/
public H2DynamicIndexingComplexClientTransactionalReplicatedTest() {
super(CacheMode.REPLICATED, CacheAtomicityMode.TRANSACTIONAL, 1, CLIENT_IDX);
}
示例12: cacheMode
/** {@inheritDoc} */
@Override protected CacheMode cacheMode() {
return CacheMode.REPLICATED;
}
示例13: isReplicated
/**
* @return {@code True} if cache is replicated cache.
*/
public boolean isReplicated() {
return cacheCfg.getCacheMode() == CacheMode.REPLICATED;
}
示例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;
}
示例15: testCachePreload3
/**
* @throws Exception If failed.
*/
public void testCachePreload3() throws Exception {
cacheMode = CacheMode.REPLICATED;
cachePreloadTest();
}