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


Java CacheConfiguration.getNearConfiguration方法代码示例

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


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

示例1: prepare

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cfg Configuration.
 * @param objs Extra components.
 * @throws IgniteCheckedException If failed to inject.
 */
private void prepare(CacheConfiguration cfg, Collection<Object> objs) throws IgniteCheckedException {
    prepare(cfg, cfg.getEvictionPolicyFactory(), false);
    prepare(cfg, cfg.getEvictionPolicy(), false);
    prepare(cfg, cfg.getAffinity(), false);
    prepare(cfg, cfg.getAffinityMapper(), false);
    prepare(cfg, cfg.getEvictionFilter(), false);
    prepare(cfg, cfg.getInterceptor(), false);

    NearCacheConfiguration nearCfg = cfg.getNearConfiguration();

    if (nearCfg != null) {
        prepare(cfg, nearCfg.getNearEvictionPolicyFactory(), true);
        prepare(cfg, nearCfg.getNearEvictionPolicy(), true);
    }

    for (Object obj : objs)
        prepare(cfg, obj, false);
}
 
开发者ID:apache,项目名称:ignite,代码行数:24,代码来源:GridCacheProcessor.java

示例2: cleanup

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param cctx Cache context.
 */
private void cleanup(GridCacheContext cctx) {
    CacheConfiguration cfg = cctx.config();

    cleanup(cfg, cfg.getEvictionPolicyFactory(), false);
    cleanup(cfg, cfg.getEvictionPolicy(), false);
    cleanup(cfg, cfg.getAffinity(), false);
    cleanup(cfg, cfg.getAffinityMapper(), false);
    cleanup(cfg, cfg.getEvictionFilter(), false);
    cleanup(cfg, cfg.getInterceptor(), false);
    cleanup(cfg, cctx.store().configuredStore(), false);

    if (!CU.isUtilityCache(cfg.getName()) && !CU.isSystemCache(cfg.getName())) {
        unregisterMbean(cctx.cache().localMxBean(), cfg.getName(), false);
        unregisterMbean(cctx.cache().clusterMxBean(), cfg.getName(), false);
    }

    NearCacheConfiguration nearCfg = cfg.getNearConfiguration();

    if (nearCfg != null) {
        cleanup(cfg, nearCfg.getNearEvictionPolicyFactory(), true);
        cleanup(cfg, nearCfg.getNearEvictionPolicy(), true);
    }

    cctx.cleanup();
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:GridCacheProcessor.java

示例3: lifecycleAwares

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param grp Cache group.
 * @param ccfg Cache configuration.
 * @param objs Extra components.
 * @return Components provided in cache configuration which can implement {@link LifecycleAware} interface.
 */
private Iterable<Object> lifecycleAwares(CacheGroupContext grp, CacheConfiguration ccfg, Object... objs) {
    Collection<Object> ret = new ArrayList<>(7 + objs.length);

    if (grp.affinityFunction() != ccfg.getAffinity())
        ret.add(ccfg.getAffinity());

    ret.add(ccfg.getAffinityMapper());
    ret.add(ccfg.getEvictionFilter());
    ret.add(ccfg.getEvictionPolicyFactory());
    ret.add(ccfg.getEvictionPolicy());
    ret.add(ccfg.getInterceptor());

    NearCacheConfiguration nearCfg = ccfg.getNearConfiguration();

    if (nearCfg != null) {
        ret.add(nearCfg.getNearEvictionPolicyFactory());
        ret.add(nearCfg.getNearEvictionPolicy());
    }

    Collections.addAll(ret, objs);

    return ret;
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:GridCacheProcessor.java

示例4: testGetFromBackupStoreReadThroughDisabled

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testGetFromBackupStoreReadThroughDisabled() throws Exception {
    for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
        ccfg.setCacheStoreFactory(new TestStoreFactory());
        ccfg.setReadThrough(false);

        boolean near = (ccfg.getNearConfiguration() != null);

        log.info("Test cache [mode=" + ccfg.getCacheMode() +
            ", atomicity=" + ccfg.getAtomicityMode() +
            ", backups=" + ccfg.getBackups() +
            ", near=" + near + "]");

        ignite(0).createCache(ccfg);

        awaitPartitionMapExchange();

        try {
            checkLocalRead(NODES, ccfg);
        }
        finally {
            ignite(0).destroyCache(ccfg.getName());
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:IgniteCacheReadFromBackupTest.java

示例5: testNoPrimaryReadPreloadFinished

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testNoPrimaryReadPreloadFinished() throws Exception {
    for (CacheConfiguration<Object, Object> ccfg : cacheConfigurations()) {
        boolean near = (ccfg.getNearConfiguration() != null);

        log.info("Test cache [mode=" + ccfg.getCacheMode() +
            ", atomicity=" + ccfg.getAtomicityMode() +
            ", backups=" + ccfg.getBackups() +
            ", near=" + near + "]");

        ignite(0).createCache(ccfg);

        awaitPartitionMapExchange();

        try {
            checkLocalRead(NODES, ccfg);
        }
        finally {
            ignite(0).destroyCache(ccfg.getName());
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:IgniteCacheReadFromBackupTest.java

示例6: compareVersionWithPrimaryNode

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param e Entry.
 * @param cache Cache.
 * @throws Exception If failed.
 */
private void compareVersionWithPrimaryNode(CacheEntry<Integer, ?> e, IgniteCache<Integer, TestValue> cache)
    throws Exception {
    CacheConfiguration cfg = cache.getConfiguration(CacheConfiguration.class);

    if (cfg.getCacheMode() != LOCAL) {
        Ignite prim = primaryNode(e.getKey(), cache.getName());

        GridCacheAdapter<Object, Object> cacheAdapter = ((IgniteKernal)prim).internalCache(cache.getName());

        if (cfg.getNearConfiguration() != null)
            cacheAdapter = ((GridNearCacheAdapter)cacheAdapter).dht();

        IgniteCacheObjectProcessor cacheObjects = cacheAdapter.context().cacheObjects();

        CacheObjectContext cacheObjCtx = cacheAdapter.context().cacheObjectContext();

        GridCacheEntryEx mapEntry = cacheAdapter.entryEx(cacheObjects.toCacheKeyObject(
            cacheObjCtx, cacheAdapter.context(), e.getKey(), true));

        mapEntry.unswap();

        assertNotNull("No entry for key: " + e.getKey(), mapEntry);
        assertEquals(mapEntry.version(), e.version());
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:31,代码来源:CacheGetEntryAbstractTest.java

示例7: executeForNodeAndCache

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
private void executeForNodeAndCache(CacheConfiguration ccfg, Ignite ignite, TestClosure clo,
    TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
    String cacheName = ccfg.getName();

    IgniteCache cache;

    if (ignite.configuration().isClientMode() &&
        ccfg.getCacheMode() == CacheMode.PARTITIONED &&
        ccfg.getNearConfiguration() != null)
        cache = ignite.getOrCreateNearCache(ccfg.getName(), ccfg.getNearConfiguration());
    else
        cache = ignite.cache(ccfg.getName());

    cache.removeAll();

    assertEquals(0, cache.size());

    clo.configure(ignite, cache, concurrency, isolation);

    log.info("Running test with node " + ignite.name() + ", cache " + cacheName);

    clo.key1 = 1;
    clo.key2 = 4;

    clo.run();
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:IgniteSqlNotNullConstraintTest.java

示例8: isNearEnabled

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Checks if near cache is enabled for cache configuration.
 *
 * @param cfg Cache configuration to check.
 * @return {@code True} if near cache is enabled, {@code false} otherwise.
 */
@SuppressWarnings("SimplifiableIfStatement")
public static boolean isNearEnabled(CacheConfiguration cfg) {
    if (cfg.getCacheMode() == LOCAL)
        return false;

    return cfg.getNearConfiguration() != null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:GridCacheUtils.java

示例9: VisorCacheNearConfiguration

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * Create data transfer object for near cache configuration properties.
 *
 * @param ccfg Cache configuration.
 */
public VisorCacheNearConfiguration(CacheConfiguration ccfg) {
    nearEnabled = GridCacheUtils.isNearEnabled(ccfg);

    if (nearEnabled) {
        NearCacheConfiguration nccfg = ccfg.getNearConfiguration();

        final Factory nearEvictionPlc = nccfg.getNearEvictionPolicyFactory();

        nearStartSize = nccfg.getNearStartSize();
        nearEvictPlc = compactClass(nearEvictionPlc);
        nearEvictMaxSize = evictionPolicyMaxSize(nearEvictionPlc);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:VisorCacheNearConfiguration.java

示例10: nearPolicy

import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
 * @param i Grid index.
 * @return Policy.
 */
@SuppressWarnings({"unchecked"})
protected T nearPolicy(int i) {
    CacheConfiguration cfg = grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class);

    NearCacheConfiguration nearCfg = cfg.getNearConfiguration();

    return (T)(nearCfg == null ? null : nearCfg.getNearEvictionPolicy());
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:EvictionAbstractTest.java


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