本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setCacheConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setCacheConfiguration方法的具体用法?Java IgniteConfiguration.setCacheConfiguration怎么用?Java IgniteConfiguration.setCacheConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setCacheConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Override
public IgniteConfiguration build() {
IgniteConfiguration config = new IgniteConfiguration();
config.setPeerClassLoadingEnabled(true);
config.setClientMode(false);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryMulticastIpFinder ipFinder = new TcpDiscoveryMulticastIpFinder();
ArrayList<String> addrs = new ArrayList<>();
addrs.add("127.0.0.1:47500..47509");
ipFinder.setAddresses(addrs);
discoSpi.setIpFinder(ipFinder);
config.setDiscoverySpi(discoSpi);
CacheConfiguration accountCacheCfg = new CacheConfiguration()
.setName("BREED")
.setAtomicityMode(TRANSACTIONAL)
.setIndexedTypes(
String.class, Breed.class
);
config.setCacheConfiguration(accountCacheCfg);
return config;
}
示例2: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_ASYNC);
cacheCfg.setRebalanceMode(NONE);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions));
cacheCfg.setBackups(backups);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
//cacheCfg.setRebalanceThreadPoolSize(1);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setCacheConfiguration(cacheCfg);
cfg.setDeploymentMode(CONTINUOUS);
return cfg;
}
示例3: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(
cacheConfiguration("test0", "test0"),
cacheConfiguration("test1", "tEst1"),
cacheConfiguration("test2", "\"TestCase\""));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例4: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration<?,?> cache = defaultCacheConfiguration();
cache.setCacheMode(PARTITIONED);
cache.setBackups(1);
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setIndexedTypes(
Integer.class, TestObject.class
);
cfg.setCacheConfiguration(cache);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例5: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (hasCache) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(CacheMode.PARTITIONED);
ccfg.setBackups(1);
ccfg.setName(CACHE_NAME);
ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg.setRebalanceMode(CacheRebalanceMode.SYNC);
cfg.setCacheConfiguration(ccfg);
}
return cfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
// Discovery.
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setAffinity(new RendezvousAffinityFunction(false, 18));
cc.setBackups(1);
cc.setRebalanceMode(SYNC);
cc.setNearConfiguration(null);
c.setCacheConfiguration(cc);
return c;
}
示例7: prepareConfig
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <K, V> IgniteConfiguration prepareConfig(HBaseCacheStoreSessionListener cssl,
HBaseCacheStore<K, V> cs, boolean writeBehind) {
IgniteConfiguration cfg = new IgniteConfiguration();
CacheConfiguration<K, V> cacheCfg = new CacheConfiguration<>();
cacheCfg.setWriteThrough(true);
cacheCfg.setWriteBehindEnabled(writeBehind);
cacheCfg.setReadThrough(true);
cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(cs));
cacheCfg.setCacheStoreSessionListenerFactories(FactoryBuilder.factoryOf(cssl));
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
示例8: startDownloadIgnite
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startDownloadIgnite (Map<String,String> group_attrs,String cachename,String gridName) {
CacheConfiguration cacheCfg = new CacheConfiguration (cachename);
cacheCfg.setCacheMode (CacheMode.PARTITIONED);
IgniteConfiguration cfg = new IgniteConfiguration ();
cfg.setCacheConfiguration (cacheCfg);
cfg.setUserAttributes (group_attrs);
cfg.setPeerClassLoadingEnabled (true);
cfg.setGridName(gridName);
Ignite ignite = Ignition.start (cfg);
// Collection<UUID> node_ids = new ArrayList<> ();
//
// ClusterGroup cg = ignite.cluster ().forRemotes ();
// Collection<ClusterNode> clusterNodes = cg.nodes ();
// for (ClusterNode e : clusterNodes) {
// node_ids.add (e.id ());
// }
// String url = "https://ws1.sinaimg.cn/large/006tNc79ly1fn4o49dqcaj30sg0sgmzo.jpg
// ";
return ignite;
}
示例9: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的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(ATOMIC);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
return cfg;
}
示例10: configuration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Node configuration.
*
* @param idx Node index.
* @return Node configuration.
* @throws Exception If failed.
*/
private IgniteConfiguration configuration(int idx) throws Exception {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(cacheMode());
ccfg.setAtomicityMode(atomicityMode());
ccfg.setRebalanceMode(SYNC);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setEvictionPolicy(null);
if (cacheMode() == PARTITIONED)
ccfg.setBackups(backups());
if (atomicityMode() != ATOMIC && cacheMode() == PARTITIONED) {
ccfg.setNearConfiguration(new NearCacheConfiguration());
}
IgniteConfiguration cfg = getConfiguration(nodeName(idx));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setLocalHost("127.0.0.1");
cfg.setCacheConfiguration(ccfg);
cfg.setConnectorConfiguration(null);
return cfg;
}
示例11: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(cacheConfiguration());
return cfg;
}
示例12: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500"));
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder));
cfg.setCacheConfiguration();
cfg.setLocalHost("127.0.0.1");
cfg.setConnectorConfiguration(null);
return cfg;
}
示例13: getIgniteConfig
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration getIgniteConfig(boolean clientMode) throws Exception {
IgniteConfiguration igniteConfig = new IgniteConfiguration();
igniteConfig.setClientMode(clientMode);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
ipFinder.setAddresses(Collections.singletonList("localhost:47500..47509"));
TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
tcpDiscoverySpi.setIpFinder(ipFinder);
igniteConfig.setDiscoverySpi(tcpDiscoverySpi);
igniteConfig.setCacheConfiguration(cacheConfig());
return igniteConfig;
}
示例14: igniteConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Ignite configuration ignite configuration.
*
* @return the ignite configuration
*/
@RefreshScope
@Bean
public IgniteConfiguration igniteConfiguration() {
final IgniteProperties ignite = casProperties.getTicket().getRegistry().getIgnite();
final IgniteConfiguration config = new IgniteConfiguration();
final TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setHeartbeatFrequency(ignite.getHeartbeatFrequency());
spi.setJoinTimeout(ignite.getJoinTimeout());
if (!StringUtils.isEmpty(ignite.getLocalAddress())) {
spi.setLocalAddress(ignite.getLocalAddress());
}
if (ignite.getLocalPort() != -1) {
spi.setLocalPort(ignite.getLocalPort());
}
spi.setNetworkTimeout(ignite.getNetworkTimeout());
spi.setSocketTimeout(ignite.getSocketTimeout());
spi.setThreadPriority(ignite.getThreadPriority());
spi.setForceServerMode(ignite.isForceServerMode());
final TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
finder.setAddresses(StringUtils.commaDelimitedListToSet(ignite.getIgniteAddresses()));
spi.setIpFinder(finder);
config.setDiscoverySpi(spi);
final List<CacheConfiguration> configurations = new ArrayList<>();
final CacheConfiguration ticketsCache = new CacheConfiguration();
ticketsCache.setName(ignite.getTicketsCache().getCacheName());
ticketsCache.setCacheMode(CacheMode.valueOf(ignite.getTicketsCache().getCacheMode()));
ticketsCache.setAtomicityMode(CacheAtomicityMode.valueOf(ignite.getTicketsCache().getAtomicityMode()));
ticketsCache.setWriteSynchronizationMode(
CacheWriteSynchronizationMode.valueOf(
ignite.getTicketsCache().getWriteSynchronizationMode()));
ticketsCache.setExpiryPolicyFactory(
CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS,
casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds())));
configurations.add(ticketsCache);
config.setCacheConfiguration(configurations.toArray(new CacheConfiguration[]{}));
return config;
}
示例15: igniteInstance
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Bean
public Ignite igniteInstance() {
IgniteConfiguration cfg = new IgniteConfiguration();
// Setting some custom name for the node.
cfg.setIgniteInstanceName("springDataNode");
// Enabling peer-class loading feature.
cfg.setPeerClassLoadingEnabled(true);
// Defining and creating a new cache to be used by Ignite Spring Data
// repository.
CacheConfiguration ccfgDog = new CacheConfiguration("DogCache");
CacheConfiguration ccfgBreed = new CacheConfiguration("BreedCache");
// Setting SQL schema for the cache.
ccfgBreed.setIndexedTypes(Long.class, Breed.class);
ccfgDog.setIndexedTypes(Long.class, Dog.class);
cfg.setCacheConfiguration(new CacheConfiguration[]{ccfgDog, ccfgBreed});
return Ignition.start(cfg);
}