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


Java CacheConfiguration.setNearConfiguration方法代码示例

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


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

示例1: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param name Cache name.
 * @param clsK Key class.
 * @param clsV Value class.
 * @return Cache configuration.
 */
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfiguration(@NotNull String name, String sqlSchema, Class<?> clsK,
    Class<?> clsV) {
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName(name);
    cc.setCacheMode(CacheMode.PARTITIONED);
    cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    cc.setNearConfiguration(null);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(SYNC);
    cc.setSqlSchema(sqlSchema);
    cc.setSqlFunctionClasses(GridQueryParsingTest.class);
    cc.setIndexedTypes(clsK, clsV);

    if (!QueryUtils.isSqlType(clsK))
        cc.setKeyConfiguration(new CacheKeyConfiguration(clsK));

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

示例2: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setName(CACHE_NAME);
    cc.setCacheMode(PARTITIONED);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(rebalancMode);
    cc.setRebalanceBatchSize(rebalancBatchSize);
    cc.setAffinity(new RendezvousAffinityFunction(false, partitions));
    cc.setBackups(backups);

    cc.setNearConfiguration(nearEnabled() ? new NearCacheConfiguration() : null);

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

示例3: 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

示例4: cache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @param cacheName Cache name.
 * @param backups Number of backups.
 * @return Configuration.
 */
@SuppressWarnings("unchecked")
private CacheConfiguration cache(String igniteInstanceName, String cacheName, int backups) {
    CacheConfiguration cacheCfg = new CacheConfiguration();

    cacheCfg.setName(cacheName);
    cacheCfg.setCacheMode(getCacheMode());
    cacheCfg.setAtomicityMode(getAtomicMode());
    cacheCfg.setNearConfiguration(nearConfiguration());
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);

    cacheCfg.setRebalanceMode(SYNC);

    cacheCfg.setCacheStoreFactory(new StoreFactory());

    cacheCfg.setWriteThrough(true);
    cacheCfg.setReadThrough(true);
    cacheCfg.setBackups(backups);

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

示例5: getClientConfig

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return client config
 */
private CacheConfiguration getClientConfig() {
    CacheConfiguration cfg = defaultCacheConfiguration();

    cfg.setName(CACHE_NAME_CLIENT);
    cfg.setCacheMode(PARTITIONED);
    cfg.setNearConfiguration(null);

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

示例6: dataCacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Data cache configuration.
 */
protected CacheConfiguration dataCacheConfiguration() {
    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setName("partitioned");
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setNearConfiguration(null);
    ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ccfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE));
    ccfg.setBackups(0);
    ccfg.setAtomicityMode(TRANSACTIONAL);


    return ccfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:HadoopSecondaryFileSystemConfigurationTest.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 cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setBackups(1);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setNearConfiguration(new NearCacheConfiguration());

    cfg.setCacheConfiguration(cacheCfg);

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

示例8: getConfiguration

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

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(PARTITIONED);
    cc.setBackups(1);
    cc.setAtomicityMode(TRANSACTIONAL);
    cc.setNearConfiguration(new NearCacheConfiguration());

    c.setCacheConfiguration(cc);

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

示例9: getConfiguration

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

    cfg.setDiscoverySpi(new TcpDiscoverySpi());

    CacheConfiguration ccfg = defaultCacheConfiguration();

    ccfg.setCacheMode(PARTITIONED);

    ccfg.setNearConfiguration(near ? new NearCacheConfiguration() : null);

    ccfg.setCacheMode(CacheMode.PARTITIONED);

    ccfg.setName(CACHE_NAME);

    switch (tmConfigurationType){
        case CACHE_LOOKUP:
            ccfg.setTransactionManagerLookupClassName(TestTxLookup.class.getName());
            break;
        case GLOBAL_LOOKUP:
            cfg.getTransactionConfiguration().setTxManagerLookupClassName(TestTxLookup.class.getName());
            break;
        case FACTORY:
            cfg.getTransactionConfiguration().setTxManagerFactory(new TestTxFactory());
            break;
    }

    cfg.setCacheConfiguration(ccfg);

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

示例10: getConfiguration

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(ipFinder);

    cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
    cfg.setDiscoverySpi(spi);

    CacheConfiguration cacheCfg = defaultCacheConfiguration();

    cacheCfg.setCacheMode(PARTITIONED);
    cacheCfg.setCacheStoreFactory(singletonFactory(store));
    cacheCfg.setReadThrough(true);
    cacheCfg.setWriteThrough(true);
    cacheCfg.setLoadPreviousValue(true);
    cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cacheCfg.setAffinity(aff);
    cacheCfg.setAtomicityMode(atomicityMode());
    cacheCfg.setBackups(BACKUPS);
    cacheCfg.setNearConfiguration(new NearCacheConfiguration());

    cfg.setCacheConfiguration(cacheCfg);

    cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, cntr.getAndIncrement()));

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

示例11: cacheConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration cfg = defaultCacheConfiguration();

    cfg.setCacheMode(PARTITIONED);
    cfg.setBackups(1);
    cfg.setNearConfiguration(nearConfiguration());
    cfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setAtomicityMode(atomicityMode);

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

示例12: getConfiguration

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

    CacheConfiguration ccfgLoc = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfgLoc.setName(CACHE_LOCAL);
    ccfgLoc.setCacheMode(LOCAL);
    ccfgLoc.setWriteSynchronizationMode(FULL_SYNC);
    ccfgLoc.setAtomicityMode(TRANSACTIONAL);

    CacheConfiguration ccfgPartitioned = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfgPartitioned.setName(CACHE_PARTITIONED);
    ccfgPartitioned.setCacheMode(PARTITIONED);
    ccfgPartitioned.setBackups(1);
    ccfgPartitioned.setWriteSynchronizationMode(FULL_SYNC);
    NearCacheConfiguration nearCfg = new NearCacheConfiguration();

    ccfgPartitioned.setNearConfiguration(nearCfg);

    ccfgPartitioned.setNodeFilter(new AttributeFilter(getTestIgniteInstanceName(0)));

    ccfgPartitioned.setAtomicityMode(TRANSACTIONAL);

    CacheConfiguration ccfgColocated = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfgColocated.setName(CACHE_COLOCATED);
    ccfgColocated.setCacheMode(PARTITIONED);
    ccfgColocated.setBackups(1);
    ccfgColocated.setWriteSynchronizationMode(FULL_SYNC);
    ccfgColocated.setAtomicityMode(TRANSACTIONAL);

    CacheConfiguration ccfgReplicated = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfgReplicated.setName(CACHE_REPLICATED);
    ccfgReplicated.setCacheMode(REPLICATED);
    ccfgReplicated.setWriteSynchronizationMode(FULL_SYNC);
    ccfgReplicated.setAtomicityMode(TRANSACTIONAL);

    cfg.setCacheConfiguration(ccfgLoc, ccfgPartitioned, ccfgColocated, ccfgReplicated);

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(discoSpi);

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

示例13: startSecondary

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Starts secondary IGFS
 */
private void startSecondary() {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();

    igfsCfg.setName("igfs_secondary");
    igfsCfg.setIpcEndpointConfiguration(SECONDARY_ENDPOINT_CFG);
    igfsCfg.setBlockSize(512 * 1024);
    igfsCfg.setPrefetchBlocks(1);

    CacheConfiguration dataCacheCfg = defaultCacheConfiguration();

    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setNearConfiguration(null);
    dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(GRP_SIZE));
    dataCacheCfg.setBackups(0);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);

    CacheConfiguration metaCacheCfg = defaultCacheConfiguration();

    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

    igfsCfg.setDataCacheConfiguration(dataCacheCfg);
    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setIgniteInstanceName("grid_secondary");

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);
    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    cfg.setCommunicationSpi(communicationSpi());

    G.start(cfg);
}
 
开发者ID:apache,项目名称:ignite,代码行数:46,代码来源:HadoopSecondaryFileSystemConfigurationTest.java

示例14: getConfiguration

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

    cfg.setPeerClassLoadingEnabled(false);

    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);

    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setNearConfiguration(null);
    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

    cfg.setCacheConfiguration(ccfg);

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

示例15: startPrimary

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Start a grid with the primary file system.
 *
 * @throws Exception If failed.
 */
private void startPrimary() throws Exception {
    FileSystemConfiguration igfsCfg = new FileSystemConfiguration();

    igfsCfg.setName(IGFS_PRIMARY);
    igfsCfg.setBlockSize(512);
    igfsCfg.setDefaultMode(DUAL_SYNC);
    igfsCfg.setPrefetchBlocks(1);
    igfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE);
    igfsCfg.setSecondaryFileSystem(secondaryFs.asSecondary());

    Map<String, IgfsMode> pathModes = new HashMap<>();

    pathModes.put(FILE.toString(), PRIMARY);

    igfsCfg.setPathModes(pathModes);

    CacheConfiguration dataCacheCfg = defaultCacheConfiguration();

    dataCacheCfg.setCacheMode(PARTITIONED);
    dataCacheCfg.setNearConfiguration(null);
    dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    dataCacheCfg.setAtomicityMode(TRANSACTIONAL);

    evictPlc = new IgfsPerBlockLruEvictionPolicy();

    dataCacheCfg.setEvictionPolicy(evictPlc);
    dataCacheCfg.setOnheapCacheEnabled(true);
    dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
    dataCacheCfg.setBackups(0);

    CacheConfiguration metaCacheCfg = defaultCacheConfiguration();

    metaCacheCfg.setCacheMode(REPLICATED);
    metaCacheCfg.setNearConfiguration(null);
    metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

    igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
    igfsCfg.setDataCacheConfiguration(dataCacheCfg);

    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setIgniteInstanceName("grid-primary");

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));

    cfg.setDiscoverySpi(discoSpi);
    cfg.setFileSystemConfiguration(igfsCfg);

    cfg.setLocalHost("127.0.0.1");
    cfg.setConnectorConfiguration(null);

    Ignite g = G.start(cfg);

    igfsPrimary = (IgfsImpl)g.fileSystem(IGFS_PRIMARY);

    dataCache = igfsPrimary.context().kernalContext().cache().internalCache(
        igfsPrimary.context().configuration().getDataCacheConfiguration().getName());
}
 
开发者ID:apache,项目名称:ignite,代码行数:67,代码来源:IgfsCachePerBlockLruEvictionPolicySelfTest.java


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