本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setNodeId方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setNodeId方法的具体用法?Java IgniteConfiguration.setNodeId怎么用?Java IgniteConfiguration.setNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setNodeId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configuration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteConfiguration configuration() {
if (staticCfg != null)
return staticCfg;
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMarshaller(marshaller);
cfg.setNodeId(nodeId);
cfg.setMBeanServer(jmx);
cfg.setIgniteHome(home);
cfg.setLocalHost(locHost);
try {
cfg.setWorkDirectory(U.defaultWorkDirectory());
}
catch (IgniteCheckedException e) {
throw new IgniteException("Failed to get default work directory.", e);
}
return cfg;
}
示例2: 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);
}
示例3: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setNodeId(null);
cfg.setFailoverSpi(new AlwaysFailoverSpi() {
/** {@inheritDoc} */
@Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) {
failCnt.incrementAndGet();
return super.failover(ctx, top);
}
});
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);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
if (igniteInstanceName.matches(".*\\d")) {
String idStr = UUID.randomUUID().toString();
char[] chars = idStr.toCharArray();
chars[chars.length - 3] = '0';
chars[chars.length - 2] = '0';
chars[chars.length - 1] = igniteInstanceName.charAt(igniteInstanceName.length() - 1);
cfg.setNodeId(UUID.fromString(new String(chars)));
}
cfg.setCommunicationSpi(new TestTcpCommunicationSpi());
CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setBackups(backupCnt);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 32));
cfg.setCacheConfiguration(cacheCfg);
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);
cfg.setNodeId(null);
cfg.setFailoverSpi(new AlwaysFailoverSpi() {
/** Ignite instance. */
@IgniteInstanceResource
private Ignite ignite;
/** {@inheritDoc} */
@Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> grid) {
if (grid.size() != 1) {
failed.set(true);
error("Unexpected grid size [expected=1, grid=" + grid + ']');
}
UUID locNodeId = ignite.configuration().getNodeId();
for (ClusterNode node : grid) {
if (node.id().equals(locNodeId)) {
failed.set(true);
error("Grid shouldn't contain local node [localNodeId=" + locNodeId + ", grid=" + grid + ']');
}
}
return super.failover(ctx, grid);
}
});
return cfg;
}
示例6: 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);
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TestCommunicationSpi commSpi = new TestCommunicationSpi();
commSpi.setSharedMemoryPort(-1);
cfg.setCommunicationSpi(commSpi);
cfg.setPeerClassLoadingEnabled(false);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setNetworkTimeout(5000);
if (nodeId != null) {
cfg.setNodeId(nodeId);
nodeId = null;
}
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(STATIC_CACHE);
cfg.setCacheConfiguration(ccfg);
return cfg;
}