本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setIgniteInstanceName方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setIgniteInstanceName方法的具体用法?Java IgniteConfiguration.setIgniteInstanceName怎么用?Java IgniteConfiguration.setIgniteInstanceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setIgniteInstanceName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: helloworldConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static IgniteConfiguration helloworldConfiguration() {
int cpus = Runtime.getRuntime().availableProcessors();
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("hello-world");
cfg.setClientMode(true);
cfg.setPeerClassLoadingEnabled(true);
cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
cfg.setPeerClassLoadingMissedResourcesCacheSize(200);
cfg.setPublicThreadPoolSize(4 * cpus);
cfg.setSystemThreadPoolSize(2 * cpus);
// log frequency in ms
cfg.setMetricsLogFrequency(30000);
cfg.setGridLogger(igniteLogger());
cfg.setDiscoverySpi(multicastDiscoverySpi());
return cfg;
}
示例2: igniteInstance
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Creating Apache Ignite instance bean. A bean will be passed to {@link IgniteRepositoryFactoryBean} to initialize
* all Ignite based Spring Data repositories and connect to a cluster.
*/
@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 ccfg = new CacheConfiguration("PersonCache");
// Setting SQL schema for the cache.
ccfg.setIndexedTypes(Long.class, Person.class);
cfg.setCacheConfiguration(ccfg);
return Ignition.start(cfg);
}
示例3: copyDefaultsFromSource
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @param cfg Config.
* @param srcCfg Source config.
*/
private static void copyDefaultsFromSource(IgniteConfiguration cfg, IgniteConfiguration srcCfg) {
cfg.setIgniteInstanceName(srcCfg.getIgniteInstanceName());
cfg.setGridLogger(srcCfg.getGridLogger());
cfg.setNodeId(srcCfg.getNodeId());
cfg.setIgniteHome(srcCfg.getIgniteHome());
cfg.setMBeanServer(srcCfg.getMBeanServer());
cfg.setMetricsLogFrequency(srcCfg.getMetricsLogFrequency());
cfg.setConnectorConfiguration(srcCfg.getConnectorConfiguration());
cfg.setCommunicationSpi(srcCfg.getCommunicationSpi());
cfg.setNetworkTimeout(srcCfg.getNetworkTimeout());
cfg.setDiscoverySpi(srcCfg.getDiscoverySpi());
cfg.setCheckpointSpi(srcCfg.getCheckpointSpi());
cfg.setIncludeEventTypes(srcCfg.getIncludeEventTypes());
// Specials.
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
}
示例4: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
String path = builtinKeys
? "modules/spring/src/test/config/jdbc-pojo-store-builtin.xml"
: "modules/spring/src/test/config/jdbc-pojo-store-obj.xml";
URL url = U.resolveIgniteUrl(path);
IgniteSpringHelper spring = IgniteComponentType.SPRING.create(false);
IgniteConfiguration cfg = spring.loadConfigurations(url).get1().iterator().next();
if (sqlEscapeAll()) {
for (CacheConfiguration ccfg : cfg.getCacheConfiguration())
((CacheJdbcPojoStoreFactory)ccfg.getCacheStoreFactory()).setSqlEscapeAll(true);
}
cfg.setIgniteInstanceName(igniteInstanceName);
return cfg;
}
示例5: loadConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @param cfgUrl Config URL.
* @param jdbcName Appended to instance name or used as default.
* @return Ignite config and Spring context.
*/
private IgniteBiTuple<IgniteConfiguration, ? extends GridSpringResourceContext> loadConfiguration(String cfgUrl,
String jdbcName) {
try {
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap =
IgnitionEx.loadConfigurations(cfgUrl);
IgniteConfiguration cfg = F.first(cfgMap.get1());
if (cfg.getIgniteInstanceName() == null)
cfg.setIgniteInstanceName(jdbcName);
else
cfg.setIgniteInstanceName(cfg.getIgniteInstanceName() + "-" + jdbcName);
cfg.setClientMode(true); // Force client mode.
return new IgniteBiTuple<>(cfg, cfgMap.getValue());
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
示例6: config
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @param name Name.
* @param client Client.
*/
private static IgniteConfiguration config(String name, boolean client, boolean forceServerMode) {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName(name);
cfg.setClientMode(client);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setForceServerMode(forceServerMode);
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例7: startGridWithSpringCtx
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Starts new grid with given name.
*
* @param gridName Grid name.
* @param client Client mode.
* @param cfgUrl Config URL.
* @return Started grid.
* @throws Exception If failed.
*/
protected Ignite startGridWithSpringCtx(String gridName, boolean client, String cfgUrl) throws Exception {
IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap =
IgnitionEx.loadConfigurations(cfgUrl);
IgniteConfiguration cfg = F.first(cfgMap.get1());
cfg.setIgniteInstanceName(gridName);
cfg.setClientMode(client);
return IgnitionEx.start(cfg, cfgMap.getValue());
}
示例8: check
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Perform check.
*
* @param sqlCfg SQL configuration.
* @param success Success flag. * @throws Exception If failed.
*/
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "unchecked"})
private void check(SqlConnectorConfiguration sqlCfg, boolean success) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration();
cfg.setIgniteInstanceName(SqlConnectorConfigurationValidationSelfTest.class.getName() + "-" +
NODE_IDX_GEN.incrementAndGet());
cfg.setLocalHost("127.0.0.1");
cfg.setSqlConnectorConfiguration(sqlCfg);
cfg.setMarshaller(new BinaryMarshaller());
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(spi);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME)
.setIndexedTypes(SqlConnectorKey.class, SqlConnectorValue.class);
cfg.setCacheConfiguration(ccfg);
if (success)
startGrid(cfg.getIgniteInstanceName(), cfg);
else {
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
startGrid(cfg.getIgniteInstanceName(), cfg);
return null;
}
}, IgniteException.class, null);
}
}
示例9: startGridWithIgfs
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Start grid with IGFS.
*
* @param igniteInstanceName Ignite instance name.
* @param mode IGFS mode.
* @param secondaryFs Secondary file system (optional).
* @return Started grid instance.
* @throws Exception If failed.
*/
protected Ignite startGridWithIgfs(
String igniteInstanceName, IgfsMode mode, @Nullable IgfsSecondaryFileSystem secondaryFs
) throws Exception {
final FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setBlockSize(igfsBlockSize);
igfsCfg.setDefaultMode(mode);
igfsCfg.setSecondaryFileSystem(secondaryFs);
CacheConfiguration<?,?> dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(affGrpSize));
dataCacheCfg.setBackups(numBackups);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
CacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName(igniteInstanceName);
cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
return startGrid(igniteInstanceName, cfg);
}
示例10: check
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Perform check.
*
* @param odbcCfg ODBC configuration.
* @param success Success flag. * @throws Exception If failed.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void check(OdbcConfiguration odbcCfg, boolean success) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration();
cfg.setIgniteInstanceName(OdbcConfigurationValidationSelfTest.class.getName() + "-" +
NODE_IDX_GEN.incrementAndGet());
cfg.setLocalHost("127.0.0.1");
cfg.setOdbcConfiguration(odbcCfg);
cfg.setMarshaller(new BinaryMarshaller());
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(spi);
if (success)
startGrid(cfg.getIgniteInstanceName(), cfg);
else {
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
startGrid(cfg.getIgniteInstanceName(), cfg);
return null;
}
}, IgniteException.class, null);
}
}
示例11: setNodeID
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private void setNodeID(IgniteConfiguration cfg) {
UUID uuid = UUID.fromString(nodeID);
cfg.setNodeId(uuid);
cfg.setIgniteInstanceName(VERTX_NODE_PREFIX + uuid);
}
示例12: 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);
}
示例13: beforeTestsStarted
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs");
igfsCfg.setBlockSize(512);
igfsCfg.setDefaultMode(PRIMARY);
CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
dataCacheCfg.setNearConfiguration(new NearCacheConfiguration());
dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
metaCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
igfsCfg.setMetaCacheConfiguration(metaCacheCfg);
igfsCfg.setDataCacheConfiguration(dataCacheCfg);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteInstanceName("grid");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
Ignite g = G.start(cfg);
igfs = g.fileSystem("igfs");
}
示例14: startNodes
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Starts the nodes for this test.
*
* @throws Exception If failed.
*/
protected void startNodes() throws Exception {
if (mode != PRIMARY) {
// Start secondary IGFS.
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName("igfs_secondary");
igfsCfg.setIpcEndpointConfiguration(SECONDARY_ENDPOINT_CFG);
igfsCfg.setBlockSize(512 * 1024);
igfsCfg.setPrefetchBlocks(1);
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setName("partitioned");
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.setName("replicated");
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.setLocalPort(47510);
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder(true);
discoSpi.setIpFinder(finder);
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
G.start(cfg);
}
for (int i = 1; i < GRID_COUNT; ++i)
startGrid(i);
startGrid(0);
}
示例15: startSecondary
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Start a grid with the secondary file system.
*
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
private void startSecondary() throws Exception {
FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
igfsCfg.setName(IGFS_SECONDARY);
igfsCfg.setBlockSize(SECONDARY_BLOCK_SIZE);
igfsCfg.setDefaultMode(PRIMARY);
igfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG);
CacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setNearConfiguration(null);
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
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-secondary");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setFileSystemConfiguration(igfsCfg);
cfg.setLocalHost("127.0.0.1");
Ignite g = G.start(cfg);
igfsSecondary = (IgfsImpl)g.fileSystem(IGFS_SECONDARY);
}