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


Java IgniteConfiguration.setIndexingSpi方法代码示例

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


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

示例1: getConfiguration

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

示例2: getConfiguration

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

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

    cfg.setConsistentId(gridName);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(100 * 1024 * 1024).setPersistenceEnabled(true))
        .setPageSize(1024)
        .setWalMode(WALMode.LOG_ONLY);

    cfg.setDataStorageConfiguration(memCfg);

    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setAffinity(new RendezvousAffinityFunction(false, 32));
    ccfg.setRebalanceMode(ASYNC);
    ccfg.setCacheMode(REPLICATED);

    cfg.setCacheConfiguration(ccfg);

    cfg.setIndexingSpi(new ErrorOnRebalanceIndexingSpi());

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

示例3: testIndexingSpiFailure

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public void testIndexingSpiFailure() throws Exception {
    IgniteConfiguration cfg = configuration();

    cfg.setIndexingSpi(new MyBrokenIndexingSpi());

    Ignite ignite = Ignition.start(cfg);

    CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);

    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

    final IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);

    final IgniteTransactions txs = ignite.transactions();

    for (final TransactionConcurrency concurrency : TransactionConcurrency.values()) {
        for (final TransactionIsolation isolation : TransactionIsolation.values()) {
            System.out.println("Run in transaction: " + concurrency + " " + isolation);

            GridTestUtils.assertThrowsWithCause(new Callable<Void>() {
                @Override public Void call() throws Exception {
                    Transaction tx;

                    try (Transaction tx0 = tx = txs.txStart(concurrency, isolation)) {
                        cache.put(1, 1);

                        tx0.commit();
                    }

                    assertEquals(TransactionState.ROLLED_BACK, tx.state());
                    return null;
                }
            }, IgniteTxHeuristicCheckedException.class);
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:41,代码来源:IndexingSpiQuerySelfTest.java

示例4: getConfiguration

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

    TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);

    ccfg.setIndexedTypes(Integer.class, Integer.class);
    ccfg.setIndexedTypes(Byte.class, Byte.class);
    ccfg.setSqlFunctionClasses(IgniteQueryDedicatedPoolTest.class);
    ccfg.setName(CACHE_NAME);

    cfg.setCacheConfiguration(ccfg);

    if ("client".equals(gridName))
        cfg.setClientMode(true);

    cfg.setIndexingSpi(new TestIndexingSpi());

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

示例5: initializeDefaultSpi

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Initialize default SPI implementations.
 *
 * @param cfg Ignite configuration.
 */
private void initializeDefaultSpi(IgniteConfiguration cfg) {
    if (cfg.getDiscoverySpi() == null)
        cfg.setDiscoverySpi(new TcpDiscoverySpi());

    if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) {
        TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi();

        if (tcpDisco.getIpFinder() == null)
            tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());
    }

    if (cfg.getCommunicationSpi() == null)
        cfg.setCommunicationSpi(new TcpCommunicationSpi());

    if (cfg.getDeploymentSpi() == null)
        cfg.setDeploymentSpi(new LocalDeploymentSpi());

    if (cfg.getEventStorageSpi() == null)
        cfg.setEventStorageSpi(new NoopEventStorageSpi());

    if (cfg.getCheckpointSpi() == null)
        cfg.setCheckpointSpi(new NoopCheckpointSpi());

    if (cfg.getCollisionSpi() == null)
        cfg.setCollisionSpi(new NoopCollisionSpi());

    if (cfg.getFailoverSpi() == null)
        cfg.setFailoverSpi(new AlwaysFailoverSpi());

    if (cfg.getLoadBalancingSpi() == null)
        cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi());
    else {
        Collection<LoadBalancingSpi> spis = new ArrayList<>();

        boolean dfltLoadBalancingSpi = false;

        for (LoadBalancingSpi spi : cfg.getLoadBalancingSpi()) {
            spis.add(spi);

            if (!dfltLoadBalancingSpi && spi instanceof RoundRobinLoadBalancingSpi)
                dfltLoadBalancingSpi = true;
        }

        // Add default load balancing SPI for internal tasks.
        if (!dfltLoadBalancingSpi)
            spis.add(new RoundRobinLoadBalancingSpi());

        cfg.setLoadBalancingSpi(spis.toArray(new LoadBalancingSpi[spis.size()]));
    }

    if (cfg.getIndexingSpi() == null)
        cfg.setIndexingSpi(new NoopIndexingSpi());
}
 
开发者ID:apache,项目名称:ignite,代码行数:59,代码来源:IgnitionEx.java

示例6: testSimpleIndexingSpi

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testSimpleIndexingSpi() throws Exception {
    IgniteConfiguration cfg = configuration();

    cfg.setIndexingSpi(new MyIndexingSpi());

    Ignite ignite = Ignition.start(cfg);

    CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);

    IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);

    for (int i = 0; i < 10; i++)
        cache.put(i, i);

    QueryCursor<Cache.Entry<Integer, Integer>> cursor = cache.query(new SpiQuery<Integer, Integer>().setArgs(2, 5));

    for (Cache.Entry<Integer, Integer> entry : cursor)
        System.out.println(entry);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:IndexingSpiQuerySelfTest.java

示例7: testIndexingSpiWithDisabledQueryProcessor

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testIndexingSpiWithDisabledQueryProcessor() throws Exception {
    IgniteConfiguration cfg = configuration();

    cfg.setIndexingSpi(new MyIndexingSpi());

    Ignite ignite = Ignition.start(cfg);

    CacheConfiguration<Integer, Integer> ccfg = cacheConfiguration(CACHE_NAME);

    IgniteCache<Integer, Integer> cache = ignite.createCache(ccfg);

    for (int i = 0; i < 10; i++)
        cache.put(i, i);

    QueryCursor<Cache.Entry<Integer, Integer>> cursor = cache.query(new SpiQuery<Integer, Integer>().setArgs(2, 5));

    for (Cache.Entry<Integer, Integer> entry : cursor)
        System.out.println(entry);
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:IndexingSpiQuerySelfTest.java

示例8: testBinaryIndexingSpi

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testBinaryIndexingSpi() throws Exception {
    IgniteConfiguration cfg = configuration();

    cfg.setIndexingSpi(new MyBinaryIndexingSpi());

    Ignite ignite = Ignition.start(cfg);

    CacheConfiguration<PersonKey, Person> ccfg = cacheConfiguration(CACHE_NAME);

    IgniteCache<PersonKey, Person> cache = ignite.createCache(ccfg);

    for (int i = 0; i < 10; i++) {
        PersonKey key = new PersonKey(i);

        cache.put(key, new Person("John Doe " + i));
    }

    QueryCursor<Cache.Entry<PersonKey, Person>> cursor = cache.query(
        new SpiQuery<PersonKey, Person>().setArgs(new PersonKey(2), new PersonKey(5)));

    for (Cache.Entry<PersonKey, Person> entry : cursor)
        System.out.println(entry);

    cache.remove(new PersonKey(9));
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:IndexingSpiQuerySelfTest.java

示例9: testNonBinaryIndexingSpi

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testNonBinaryIndexingSpi() throws Exception {
    System.setProperty(IgniteSystemProperties.IGNITE_UNWRAP_BINARY_FOR_INDEXING_SPI, "true");

    IgniteConfiguration cfg = configuration();

    cfg.setIndexingSpi(new MyIndexingSpi());

    Ignite ignite = Ignition.start(cfg);

    CacheConfiguration<PersonKey, Person> ccfg = cacheConfiguration(CACHE_NAME);

    IgniteCache<PersonKey, Person> cache = ignite.createCache(ccfg);

    for (int i = 0; i < 10; i++) {
        PersonKey key = new PersonKey(i);

        cache.put(key, new Person("John Doe " + i));
    }

    QueryCursor<Cache.Entry<PersonKey, Person>> cursor = cache.query(
        new SpiQuery<PersonKey, Person>().setArgs(new PersonKey(2), new PersonKey(5)));

    for (Cache.Entry<PersonKey, Person> entry : cursor)
        System.out.println(entry);

    cache.remove(new PersonKey(9));
}
 
开发者ID:apache,项目名称:ignite,代码行数:31,代码来源:IndexingSpiQuerySelfTest.java

示例10: getConfiguration

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

    cfg.setIndexingSpi(new TestIndexingSpi());

    cfg.getTransactionConfiguration().setTxSerializableEnabled(true);

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


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