本文整理汇总了Java中org.apache.ignite.cache.CacheAtomicityMode类的典型用法代码示例。如果您正苦于以下问题:Java CacheAtomicityMode类的具体用法?Java CacheAtomicityMode怎么用?Java CacheAtomicityMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CacheAtomicityMode类属于org.apache.ignite.cache包,在下文中一共展示了CacheAtomicityMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param config the akka configuration object
* @param actorSystem the akk actor system
* @return the created snapshot ignite cache
*/
@Override
public IgniteCache<Long, SnapshotItem> apply(Config config, ActorSystem actorSystem) {
final IgniteExtension extension = IgniteExtensionProvider.EXTENSION.get(actorSystem);
final String cachePrefix = config.getString(CACHE_PREFIX_PROPERTY);
final int cacheBackups = config.getInt(CACHE_BACKUPS);
final CacheConfiguration<Long, SnapshotItem> eventStore = new CacheConfiguration();
eventStore.setCopyOnRead(false);
if (cacheBackups > 0) {
eventStore.setBackups(cacheBackups);
} else {
eventStore.setBackups(1);
}
eventStore.setAtomicityMode(CacheAtomicityMode.ATOMIC);
eventStore.setName(cachePrefix + "_SNAPSHOT");
eventStore.setCacheMode(CacheMode.PARTITIONED);
eventStore.setReadFromBackup(true);
eventStore.setIndexedTypes(Long.class, SnapshotItem.class);
eventStore.setIndexedTypes(String.class, SnapshotItem.class);
return extension.getIgnite().getOrCreateCache(eventStore);
}
开发者ID:Romeh,项目名称:akka-persistance-ignite,代码行数:26,代码来源:SnapshotCacheProvider.java
示例2: createCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* Creates cache with full configuration. Active store is used.
*
* @param cacheName name of cache.
* @param atomicityMode atomicity.
* @param cacheMode mode.
* @param writeBehindEnabled should write behind be used for active store.
* @param flushFreq flush frequency for write behind.
* @param base configuration to copy settings from.
* @param <K> type of key.
* @param <V> type of value
* @return cache instance.
*/
@SuppressWarnings("unchecked")
public <K, V> IgniteCache<K, V> createCache(String cacheName, CacheAtomicityMode atomicityMode, CacheMode cacheMode,
boolean writeBehindEnabled, int flushFreq,
CacheConfiguration<K, V> base) {
CacheConfiguration<K, V> realConfiguration = base == null
? new CacheConfiguration<K, V>()
: new CacheConfiguration<K, V>(base);
realConfiguration.setName(cacheName);
realConfiguration.setAtomicityMode(atomicityMode);
realConfiguration.setCacheMode(cacheMode);
realConfiguration.setBackups(2);
realConfiguration.setWriteThrough(true);
realConfiguration.setReadThrough(true);
realConfiguration.setWriteBehindEnabled(writeBehindEnabled);
realConfiguration.setWriteBehindFlushFrequency(flushFreq);
realConfiguration.setCacheStoreFactory(activeStoreConfiguration.activeCacheStoreFactory());
return ignite().createCache(realConfiguration);
}
开发者ID:epam,项目名称:Lagerta,代码行数:32,代码来源:TestResources.java
示例3: createEntityCacheConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
private CacheConfiguration<?,?> createEntityCacheConfiguration(EntityKeyMetadata entityKeyMetadata, SchemaDefinitionContext context) {
CacheConfiguration<?,?> cacheConfiguration = new CacheConfiguration<>();
cacheConfiguration.setStoreKeepBinary( true );
cacheConfiguration.setSqlSchema( QueryUtils.DFLT_SCHEMA );
cacheConfiguration.setBackups( 1 );
cacheConfiguration.setName( StringHelper.stringBeforePoint( entityKeyMetadata.getTable() ) );
cacheConfiguration.setAtomicityMode( CacheAtomicityMode.TRANSACTIONAL );
QueryEntity queryEntity = new QueryEntity();
queryEntity.setTableName( entityKeyMetadata.getTable() );
queryEntity.setKeyType( getEntityIdClassName( entityKeyMetadata.getTable(), context ).getSimpleName() );
queryEntity.setValueType( StringHelper.stringAfterPoint( entityKeyMetadata.getTable() ) );
addTableInfo( queryEntity, context, entityKeyMetadata.getTable() );
for ( AssociationKeyMetadata associationKeyMetadata : context.getAllAssociationKeyMetadata() ) {
if ( associationKeyMetadata.getAssociationKind() != AssociationKind.EMBEDDED_COLLECTION
&& associationKeyMetadata.getTable().equals( entityKeyMetadata.getTable() )
&& !IgniteAssociationSnapshot.isThirdTableAssociation( associationKeyMetadata ) ) {
appendIndex( queryEntity, associationKeyMetadata, context );
}
}
log.debugf( "queryEntity: %s", queryEntity );
cacheConfiguration.setQueryEntities( Arrays.asList( queryEntity ) );
return cacheConfiguration;
}
开发者ID:hibernate,项目名称:hibernate-ogm-ignite,代码行数:26,代码来源:IgniteCacheInitializer.java
示例4: newCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* Create new ML cache if needed.
*/
private IgniteCache<MatrixBlockKey, MatrixBlockEntry> newCache() {
CacheConfiguration<MatrixBlockKey, MatrixBlockEntry> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
// Random cache name.
cfg.setName(CACHE_NAME);
return Ignition.localIgnite().getOrCreateCache(cfg);
}
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:BlockMatrixStorage.java
示例5: newCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* Create new ML cache if needed.
*/
private IgniteCache<VectorBlockKey, VectorBlockEntry> newCache() {
CacheConfiguration<VectorBlockKey, VectorBlockEntry> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
// Random cache name.
cfg.setName(CACHE_NAME);
return Ignition.localIgnite().getOrCreateCache(cfg);
}
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:BlockVectorStorage.java
示例6: newCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* Create new ML cache if needed.
*/
private IgniteCache<RowColMatrixKey, Double> newCache() {
CacheConfiguration<RowColMatrixKey, Double> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
// Random cache name.
cfg.setName(CACHE_NAME);
return Ignition.localIgnite().getOrCreateCache(cfg);
}
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:27,代码来源:SparseDistributedVectorStorage.java
示例7: testAdd
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
@Test
public void testAdd() throws Exception {
L2CacheConfig base = new L2CacheConfig();
base.setCacheMode(CacheMode.LOCAL);
base.setNearSize(42);
assertNull(base.getAtomicityMode());
L2CacheConfig apply = new L2CacheConfig();
apply.setNearSize(56);
apply.setAtomicityMode(CacheAtomicityMode.ATOMIC);
L2CacheConfig add = AddL2CacheConfig.add(base, apply);
assertEquals(add.getNearSize(), Integer.valueOf(56));
assertEquals(add.getAtomicityMode(), CacheAtomicityMode.ATOMIC);
assertEquals(add.getCacheMode(), CacheMode.LOCAL);
assertNull(add.getBackups());
}
开发者ID:ebean-orm,项目名称:ebean-ignite,代码行数:21,代码来源:AddL2CacheConfigTest.java
示例8: getConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
if (cnt.getAndIncrement() == 0)
cfg.setClientMode(true);
else {
cfg.setIndexingSpi(new MyBrokenIndexingSpi());
CacheConfiguration ccfg = cacheConfiguration(igniteInstanceName);
ccfg.setName("test-cache");
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setIndexedTypes(Integer.class, Integer.class);
cfg.setCacheConfiguration(ccfg);
}
return cfg;
}
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:IndexingSpiQueryTxSelfTest.java
示例9: checkAddColumnNotNullCheckDmlInsertValues
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/** */
private void checkAddColumnNotNullCheckDmlInsertValues(CacheAtomicityMode atomicityMode) throws Exception {
executeSql("CREATE TABLE test(id INT PRIMARY KEY, age INT) WITH \"atomicity="
+ atomicityMode.name() + "\"");
executeSql("ALTER TABLE test ADD COLUMN name VARCHAR NOT NULL");
GridTestUtils.assertThrows(log(), new Callable<Object>() {
@Override public Object call() throws Exception {
executeSql("INSERT INTO test(id, name, age) " +
"VALUES (1, 'ok', 1), (2, NULLIF('a', 'a'), 2), (3, 'ok', 3)");
return null;
}
}, IgniteSQLException.class, ERR_MSG);
List<List<?>> result = executeSql("SELECT id, name, age FROM test ORDER BY id");
assertEquals(0, result.size());
executeSql("INSERT INTO test(id, name) VALUES (1, 'ok'), (2, 'ok2'), (3, 'ok3')");
result = executeSql("SELECT id, name FROM test ORDER BY id");
assertEquals(3, result.size());
}
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:IgniteSqlNotNullConstraintTest.java
示例10: cacheConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param cacheMode Cache mode.
* @param atomicityMode Cache atomicity mode.
* @param backups Number of backups.
* @param nearEnabled {@code True} if near cache should be enabled.
* @return Cache configuration.
*/
private CacheConfiguration<Object, Object> cacheConfiguration(CacheMode cacheMode,
CacheAtomicityMode atomicityMode,
int backups,
boolean nearEnabled) {
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(cacheMode);
ccfg.setAtomicityMode(atomicityMode);
if (cacheMode != REPLICATED) {
ccfg.setBackups(backups);
if (nearEnabled)
ccfg.setNearConfiguration(new NearCacheConfiguration<>());
}
return ccfg;
}
开发者ID:apache,项目名称:ignite,代码行数:26,代码来源:IgniteCacheReadFromBackupTest.java
示例11: cacheConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param cacheMode Cache mode.
* @param backups Number of backups.
* @param atomicityMode Cache atomicity mode.
* @return Cache configuration.
*/
protected CacheConfiguration<Object, Object> cacheConfiguration(
CacheMode cacheMode,
int backups,
CacheAtomicityMode atomicityMode) {
CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setCacheMode(cacheMode);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
if (cacheMode == PARTITIONED)
ccfg.setBackups(backups);
return ccfg;
}
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:CacheKeepBinaryIterationTest.java
示例12: cacheConfigurations
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param grp Group name.
* @param atomicityMode Atomicity mode.
* @return Cache configurations.
*/
private List<CacheConfiguration> cacheConfigurations(@Nullable String grp, CacheAtomicityMode atomicityMode) {
List<CacheConfiguration> ccfgs = new ArrayList<>();
for (int i = 0; i < 3; i++) {
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setGroupName(grp);
ccfg.setName("cache-" + atomicityMode + "-" + i);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfgs.add(ccfg);
}
return ccfgs;
}
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:IgniteDynamicClientCacheStartSelfTest.java
示例13: getConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setCommunicationSpi(new TestCommunicationSpi());
cfg.setDiscoverySpi(new TestDiscoverySpi());
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName(CACHE_NAME);
ccfg.setNearConfiguration(null);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(1);
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg.setCacheStoreFactory(new TestCacheStoreFactory());
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setWriteBehindEnabled(false);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:TxRecoveryStoreEnabledTest.java
示例14: cacheConfiguration
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param grpName Cache group name.
* @param name Cache name.
* @param cacheMode Cache mode.
* @param atomicityMode Atomicity mode.
* @param backups Backups number.
* @return Cache configuration.
*/
private CacheConfiguration cacheConfiguration(
String grpName,
String name,
CacheMode cacheMode,
CacheAtomicityMode atomicityMode,
int backups
) {
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setName(name);
ccfg.setGroupName(grpName);
ccfg.setAtomicityMode(atomicityMode);
ccfg.setBackups(backups);
ccfg.setCacheMode(cacheMode);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
return ccfg;
}
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:IgnitePersistentStoreCacheGroupsTest.java
示例15: testTransactionalCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @throws Exception If failed.
*/
public void testTransactionalCache() throws Exception {
CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(DEFAULT_CACHE_NAME, CacheAtomicityMode.TRANSACTIONAL);
IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
try {
cache.loadCache(null);
cache.get(1);
cache.put(1, 1);
cache.remove(1);
}
finally {
cache.destroy();
}
assertEquals(3, loadCacheCnt.get());
assertEquals(1, loadCnt.get());
assertEquals(1, writeCnt.get());
assertEquals(1, deleteCnt.get());
assertEquals(0, reuseCnt.get());
}
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:CacheStoreSessionListenerAbstractSelfTest.java
示例16: apply
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* @param config the akka configuration object
* @param actorSystem the akk actor system
* @return the created journal and sequence ignite caches†
*/
@Override
public JournalCaches apply(Config config, ActorSystem actorSystem) {
final IgniteExtension extension = IgniteExtensionProvider.EXTENSION.get(actorSystem);
final String cachePrefix = config.getString(CACHE_PREFIX_PROPERTY);
final int cacheBackups = config.getInt(CACHE_BACKUPS);
// cache configuration
final CacheConfiguration<Long, JournalItem> eventStore = new CacheConfiguration();
eventStore.setCopyOnRead(false);
if (cacheBackups > 0) {
eventStore.setBackups(cacheBackups);
} else {
eventStore.setBackups(1);
}
eventStore.setAtomicityMode(CacheAtomicityMode.ATOMIC);
eventStore.setName(cachePrefix);
eventStore.setCacheMode(CacheMode.PARTITIONED);
eventStore.setReadFromBackup(true);
eventStore.setIndexedTypes(Long.class, JournalItem.class);
eventStore.setIndexedTypes(String.class, JournalItem.class);
eventStore.setInterceptor(new JournalStoreInterceptor());
//sequence Number Tracking
final CacheConfiguration<String, Long> squenceNumberTrack = new CacheConfiguration();
squenceNumberTrack.setCopyOnRead(false);
if (cacheBackups > 0) {
squenceNumberTrack.setBackups(cacheBackups);
} else {
squenceNumberTrack.setBackups(1);
}
squenceNumberTrack.setAtomicityMode(CacheAtomicityMode.ATOMIC);
squenceNumberTrack.setName("sequenceNumberTrack");
squenceNumberTrack.setCacheMode(CacheMode.PARTITIONED);
squenceNumberTrack.setReadFromBackup(true);
return JournalCaches.builder()
.journalCache(extension.getIgnite().getOrCreateCache(eventStore))
.sequenceCache(extension.getIgnite().getOrCreateCache(squenceNumberTrack))
.build();
}
开发者ID:Romeh,项目名称:akka-persistance-ignite,代码行数:44,代码来源:JournalCacheProvider.java
示例17: populationCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的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
示例18: getConfig
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
@NotNull
public static CacheConfiguration<String, Object> getConfig() {
CacheConfiguration<String, Object> atomics = new CacheConfiguration<>();
atomics.setName(NAME);
atomics.setAtomicityMode(CacheAtomicityMode.ATOMIC);
atomics.setCacheMode(CacheMode.REPLICATED);
return atomics;
}
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:MetadataAtomicsHelper.java
示例19: createSimpleCache
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/**
* Creates cache with minimal configuration. Active store is not used.
*
* @param cacheName name of cache.
* @param atomicityMode atomicity.
* @param cacheMode mode.
* @param base configuration to copy settings from.
* @param <K> type of key.
* @param <V> type of value
* @return cache instance.
*/
public <K, V> IgniteCache<K, V> createSimpleCache(String cacheName, CacheAtomicityMode atomicityMode,
CacheMode cacheMode, CacheConfiguration<K, V> base) {
CacheConfiguration<K, V> realConfiguration = base == null
? new CacheConfiguration<K, V>()
: new CacheConfiguration<K, V>(base);
realConfiguration.setName(cacheName);
realConfiguration.setAtomicityMode(atomicityMode);
realConfiguration.setCacheMode(cacheMode);
realConfiguration.setBackups(2);
return ignite().createCache(realConfiguration);
}
开发者ID:epam,项目名称:Lagerta,代码行数:23,代码来源:TestResources.java
示例20: createCaches
import org.apache.ignite.cache.CacheAtomicityMode; //导入依赖的package包/类
/** */
@Before
public void createCaches() {
CacheConfiguration configuration = new CacheConfiguration<>();
configuration.setEvictionPolicy(new FifoEvictionPolicy(1));
createCache(firstCache, CacheAtomicityMode.TRANSACTIONAL, CacheMode.PARTITIONED, false, 0, configuration);
}
开发者ID:epam,项目名称:Lagerta,代码行数:8,代码来源:TransactionIsolationTest.java
注:本文中的org.apache.ignite.cache.CacheAtomicityMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论