本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.getNodeId方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.getNodeId方法的具体用法?Java IgniteConfiguration.getNodeId怎么用?Java IgniteConfiguration.getNodeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.getNodeId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: consistentId
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public Serializable consistentId() throws IgniteSpiException {
if (consistentId == null) {
initializeImpl();
initAddresses();
IgniteConfiguration cfg = ignite.configuration();
final Serializable cfgId = cfg.getConsistentId();
if (cfgId == null) {
if (cfg.isClientMode() == Boolean.TRUE)
consistentId = cfg.getNodeId();
else {
List<String> sortedAddrs = new ArrayList<>(addrs.get1());
Collections.sort(sortedAddrs);
if (getBoolean(IGNITE_CONSISTENT_ID_BY_HOST_WITHOUT_PORT))
consistentId = U.consistentId(sortedAddrs);
else
consistentId = U.consistentId(sortedAddrs, impl.boundPort());
}
}
else
consistentId = cfgId;
}
return consistentId;
}
示例2: resetShmemServer
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Creates new shared memory communication server.
*
* @return Server.
* @throws IgniteCheckedException If failed.
*/
@Nullable private IpcSharedMemoryServerEndpoint resetShmemServer() throws IgniteCheckedException {
if (boundTcpShmemPort >= 0)
throw new IgniteCheckedException("Shared memory server was already created on port " + boundTcpShmemPort);
if (shmemPort == -1 || U.isWindows())
return null;
IgniteCheckedException lastEx = null;
// If configured TCP port is busy, find first available in range.
for (int port = shmemPort; port < shmemPort + locPortRange; port++) {
try {
IgniteConfiguration cfg = ignite.configuration();
IpcSharedMemoryServerEndpoint srv =
new IpcSharedMemoryServerEndpoint(log, cfg.getNodeId(), igniteInstanceName, cfg.getWorkDirectory());
srv.setPort(port);
srv.omitOutOfResourcesWarning(true);
srv.start();
boundTcpShmemPort = port;
// Ack Port the TCP server was bound to.
if (log.isInfoEnabled())
log.info("Successfully bound shared memory communication to TCP port [port=" + boundTcpShmemPort +
", locHost=" + locHost + ']');
return srv;
}
catch (IgniteCheckedException e) {
lastEx = e;
if (log.isDebugEnabled())
log.debug("Failed to bind to local port (will try next port within range) [port=" + port +
", locHost=" + locHost + ']');
}
}
// If free port wasn't found.
throw new IgniteCheckedException("Failed to bind shared memory communication to any port within range [startPort=" +
locPort + ", portRange=" + locPortRange + ", locHost=" + locHost + ']', lastEx);
}
示例3: storeToFile
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Stores {@link IgniteConfiguration} to file as xml.
*
* @param cfg Ignite Configuration.
* @return A name of file where the configuration was stored.
* @throws IOException If failed.
* @see #readCfgFromFileAndDeleteFile(String)
*/
public static String storeToFile(IgniteConfiguration cfg, boolean resetDiscovery) throws IOException, IgniteCheckedException {
String fileName = IGNITE_CONFIGURATION_FILE + cfg.getNodeId();
storeToFile(cfg, fileName, true, resetDiscovery);
return fileName;
}