本文整理汇总了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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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;
}