本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.getIgniteInstanceName方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.getIgniteInstanceName方法的具体用法?Java IgniteConfiguration.getIgniteInstanceName怎么用?Java IgniteConfiguration.getIgniteInstanceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.getIgniteInstanceName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGridName
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private String createGridName(IgniteConfiguration conf) {
String name = null;
if ( StringUtils.isNotEmpty( config.getInstanceName() ) ) {
name = config.getInstanceName();
}
else {
IgniteConfiguration igniteConfiguration = createIgniteConfiguration();
if ( StringUtils.isNotEmpty( igniteConfiguration.getIgniteInstanceName() ) ) {
name = igniteConfiguration.getIgniteInstanceName();
}
else if ( config.getUrl() != null ) {
name = config.getUrl().getPath();
name = name.replaceAll( "[\\,\\\",:,\\*,\\/,\\\\]", "_" );
}
else {
name = UUID.randomUUID().toString();
}
}
return name;
}
示例2: 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);
}
}
示例3: VisorBasicConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Create data transfer object for node basic configuration properties.
*
* @param ignite Grid.
* @param c Grid configuration.
*/
public VisorBasicConfiguration(IgniteEx ignite, IgniteConfiguration c) {
igniteInstanceName = c.getIgniteInstanceName();
ggHome = getProperty(IGNITE_HOME, c.getIgniteHome());
locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost());
marsh = compactClass(c.getMarshaller());
deployMode = c.getDeploymentMode();
clientMode = c.isClientMode();
daemon = boolValue(IGNITE_DAEMON, c.isDaemon());
jmxRemote = ignite.isJmxRemoteEnabled();
restart = ignite.isRestartEnabled();
netTimeout = c.getNetworkTimeout();
log = compactClass(c.getGridLogger());
discoStartupDelay = c.getDiscoveryStartupDelay();
mBeanSrv = compactClass(c.getMBeanServer());
noAscii = boolValue(IGNITE_NO_ASCII, false);
noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false);
noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false);
progName = getProperty(IGNITE_PROG_NAME);
quiet = boolValue(IGNITE_QUIET, true);
successFile = getProperty(IGNITE_SUCCESS_FILE);
updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
activeOnStart = c.isActiveOnStart();
addrRslvr = compactClass(c.getAddressResolver());
cacheSanityCheckEnabled = c.isCacheSanityCheckEnabled();
clsLdr = compactClass(c.getClassLoader());
consistentId = c.getConsistentId() != null ? String.valueOf(c.getConsistentId()) : null;
failureDetectionTimeout = c.getFailureDetectionTimeout();
igniteWorkDir = c.getWorkDirectory();
lateAffAssignment = c.isLateAffinityAssignment();
marshLocJobs = c.isMarshalLocalJobs();
metricsUpdateFreq = c.getMetricsUpdateFrequency();
clientFailureDetectionTimeout = c.getClientFailureDetectionTimeout();
sndRetryCnt = c.getNetworkSendRetryCount();
sndRetryDelay = c.getNetworkSendRetryDelay();
timeSrvPortBase = c.getTimeServerPortBase();
timeSrvPortRange = c.getTimeServerPortRange();
utilityCacheKeepAliveTime = c.getUtilityCacheKeepAliveTime();
}
示例4: executeJob
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected Object executeJob(int gridSize, String type) {
log.info(">>> Starting new grid node [currGridSize=" + gridSize + ", arg=" + type + "]");
if (type == null)
throw new IllegalArgumentException("Node type to start should be specified.");
IgniteConfiguration cfg = getConfig(type);
// Generate unique for this VM Ignite instance name.
String igniteInstanceName = cfg.getIgniteInstanceName() + " (" + UUID.randomUUID() + ")";
// Update Ignite instance name (required to be unique).
cfg.setIgniteInstanceName(igniteInstanceName);
// Start new node in current VM.
Ignite g = G.start(cfg);
log.info(">>> Grid started [nodeId=" + g.cluster().localNode().id() + ", name='" + g.name() + "']");
return true;
}
示例5: start
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Starts all grids specified within given Spring XML configuration file. If grid with given name
* is already started, then exception is thrown. In this case all instances that may
* have been started so far will be stopped too.
* <p>
* Usually Spring XML configuration file will contain only one Grid definition. Note that
* Grid configuration bean(s) is retrieved form configuration file by type, so the name of
* the Grid configuration bean is ignored.
*
* @param springCfgPath Spring XML configuration file path or URL.
* @param igniteInstanceName Ignite instance name that will override default.
* @return Started grid. If Spring configuration contains multiple grid instances,
* then the 1st found instance is returned.
* @throws IgniteCheckedException If grid could not be started or configuration
* read. This exception will be thrown also if grid with given name has already
* been started or Spring XML configuration file is invalid.
*/
public static Ignite start(@Nullable String springCfgPath, @Nullable String igniteInstanceName)
throws IgniteCheckedException {
if (springCfgPath == null) {
IgniteConfiguration cfg = new IgniteConfiguration();
if (cfg.getIgniteInstanceName() == null && !F.isEmpty(igniteInstanceName))
cfg.setIgniteInstanceName(igniteInstanceName);
return start(cfg);
}
else
return start(springCfgPath, igniteInstanceName, null, null);
}