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


Java CacheConfiguration.setAtomicityMode方法代码示例

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


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

示例1: createCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例2: createEntityCacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例3: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例4: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例5: newCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例6: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cacheMode Cache mode.
 * @param backups Number of backups.
 * @param nearCache If {@code true} near cache is enabled.
 * @return Cache configuration.
 */
private CacheConfiguration<Integer, Integer> cacheConfiguration(
    CacheMode cacheMode,
    int backups,
    boolean nearCache) {
    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setCacheMode(cacheMode);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

    if (cacheMode == PARTITIONED)
        ccfg.setBackups(backups);

    if (nearCache)
        ccfg.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>());

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

示例7: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例8: getConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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);
    cc.setBackups(1);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setRebalanceMode(SYNC);
    cc.setAffinity(new RendezvousAffinityFunction(false, 15));
    cc.setIndexedTypes(
        Integer.class, Integer.class
    );

    c.setCacheConfiguration(cc);

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

示例9: getConfiguration

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

    CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    cacheCfg.setCacheMode(CacheMode.PARTITIONED);
    cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setNearConfiguration(nearEnabled ? new NearCacheConfiguration() : null);
    cacheCfg.setBackups(1);

    cfg.setCacheConfiguration(cacheCfg);

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

示例10: getConfiguration

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

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setCacheMode(PARTITIONED);
    ccfg.setAtomicityMode(atomicMode());
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setBackups(1);

    cfg.setCacheConfiguration(ccfg);

    if (isClient)
        cfg.setClientMode(true);

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

示例11: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例12: getConfiguration

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

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    cfg.setDiscoverySpi(disco);

    CacheConfiguration<?,?> cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setBackups(1);
    cacheCfg.setIndexedTypes(
        Integer.class, Integer.class
    );

    cfg.setCacheConfiguration(cacheCfg);

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

示例13: apply

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例14: populationCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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

示例15: getConfig

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的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


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