当前位置: 首页>>代码示例>>Java>>正文


Java ClusterNode.id方法代码示例

本文整理汇总了Java中org.apache.ignite.cluster.ClusterNode.id方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterNode.id方法的具体用法?Java ClusterNode.id怎么用?Java ClusterNode.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.cluster.ClusterNode的用法示例。


在下文中一共展示了ClusterNode.id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: safeLocalNodeId

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @return Local node ID.
 */
private UUID safeLocalNodeId() {
    ClusterNode locNode = getLocalNode();

    UUID id;

    if (locNode == null) {
        U.warn(log, "Local node is not started or fully initialized [isStopping=" +
            getSpiContext().isStopping() + ']');

        id = new UUID(0, 0);
    }
    else
        id = locNode.id();

    return id;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:TcpCommunicationSpi.java

示例2: validateBinaryConfiguration

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/** */
private IgniteNodeValidationResult validateBinaryConfiguration(ClusterNode rmtNode) {
    Object rmtBinaryCfg = rmtNode.attribute(IgniteNodeAttributes.ATTR_BINARY_CONFIGURATION);

    ClusterNode locNode = ctx.discovery().localNode();

    Object locBinaryCfg = locNode.attribute(IgniteNodeAttributes.ATTR_BINARY_CONFIGURATION);

    if (!F.eq(locBinaryCfg, rmtBinaryCfg)) {
        String msg = "Local node's binary configuration is not equal to remote node's binary configuration " +
            "[locNodeId=%s, rmtNodeId=%s, locBinaryCfg=%s, rmtBinaryCfg=%s]";

        return new IgniteNodeValidationResult(rmtNode.id(),
            String.format(msg, locNode.id(), rmtNode.id(), locBinaryCfg, rmtBinaryCfg),
            String.format(msg, rmtNode.id(), locNode.id(), rmtBinaryCfg, locBinaryCfg));
    }

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:CacheObjectBinaryProcessorImpl.java

示例3: primaryIgnite

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param key Key.
 * @return Ignite instance of the primary node for the specified key.
 */
protected Ignite primaryIgnite(String key) {
    ClusterNode node = grid(0).affinity(cacheName()).mapKeyToNode(key);

    if (node == null)
        throw new IgniteException("Failed to find primary node.");

    UUID nodeId = node.id();

    for (int i = 0; i < gridCount(); i++) {
        if (grid(i).localNode().id().equals(nodeId))
            return ignite(i);
    }

    throw new IgniteException("Failed to find primary node.");
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgniteCacheConfigVariationsFullApiTest.java

示例4: primaryIgnite

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param key Key.
 * @return Ignite instance for primary node.
 */
protected Ignite primaryIgnite(String key) {
    ClusterNode node = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);

    if (node == null)
        throw new IgniteException("Failed to find primary node.");

    UUID nodeId = node.id();

    for (int i = 0; i < gridCount(); i++) {
        if (grid(i).localNode().id().equals(nodeId))
            return ignite(i);
    }

    throw new IgniteException("Failed to find primary node.");
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:GridCacheAbstractFullApiSelfTest.java

示例5: run

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
@Override public void run() {
    long currentTopologyVersion = ignite.cluster().topologyVersion();
    Set<UUID> currentTopology = new HashSet<>();
    Set<UUID> newNodes = new HashSet<>();

    if ((lastTopologyVersion == null) || (currentTopologyVersion != lastTopologyVersion)) {
        for (ClusterNode node : ignite.cluster().topology(currentTopologyVersion)) {
            currentTopology.add(node.id());
            if ((aggregatorNodeId != node.id()) && !lastTopology.contains(node.id())) {
                newNodes.add(node.id());
            }
        }
        lastTopologyVersion = currentTopologyVersion;
        lastTopology = currentTopology;
    }
    else {
        return;
    }
    Collection<UUID> response = ignite.compute(ignite.cluster().forNodeIds(newNodes)).broadcast(
        new RemoteStatisticsUpdaterStartTask(aggregatorNodeId)
    );
    for (UUID nodeId : response) {
        if (nodeId != null) {
            LOGGER.info("[T] Started statistics collection on node {}", nodeId);
        }
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:28,代码来源:StatisticsDriver.java

示例6: TcpDiscoveryNode

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * IMPORTANT!
 * Only purpose of this constructor is creating node which contains necessary data to store on disc only
 * @param node to copy data from
 */
public TcpDiscoveryNode(
    ClusterNode node
) {
    this.id = node.id();
    this.consistentId = node.consistentId();
    this.addrs = node.addresses();
    this.hostNames = node.hostNames();
    this.order = node.order();
    this.ver = node.version();
    this.daemon = node.isDaemon();
    this.clientRouterNodeId = node.isClient() ? node.id() : null;

    attrs = Collections.singletonMap(ATTR_NODE_CONSISTENT_ID, consistentId);
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:TcpDiscoveryNode.java

示例7: validateNode

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public IgniteNodeValidationResult validateNode(ClusterNode node) {
    ClusterNode locNode = ctx.discovery().localNode();

    // Check version.
    String locBuildVer = locNode.attribute(ATTR_BUILD_VER);
    String rmtBuildVer = node.attribute(ATTR_BUILD_VER);

    if (!F.eq(rmtBuildVer, locBuildVer)) {
        // OS nodes don't support rolling updates.
        if (!locBuildVer.equals(rmtBuildVer)) {
            String errMsg = "Local node and remote node have different version numbers " +
                "(node will not join, Ignite does not support rolling updates, " +
                "so versions must be exactly the same) " +
                "[locBuildVer=" + locBuildVer + ", rmtBuildVer=" + rmtBuildVer +
                ", locNodeAddrs=" + U.addressesAsString(locNode) +
                ", rmtNodeAddrs=" + U.addressesAsString(node) +
                ", locNodeId=" + locNode.id() + ", rmtNodeId=" + node.id() + ']';

            LT.warn(log, errMsg);

            // Always output in debug.
            if (log.isDebugEnabled())
                log.debug(errMsg);

            return new IgniteNodeValidationResult(node.id(), errMsg, errMsg);
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:32,代码来源:OsDiscoveryNodeValidationProcessor.java

示例8: initPrimaryBackupMaps

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * Initializes primary and backup maps.
 */
private void initPrimaryBackupMaps() {
    // Temporary mirrors with modifiable partition's collections.
    Map<UUID, Set<Integer>> tmpPrm = new HashMap<>();
    Map<UUID, Set<Integer>> tmpBkp = new HashMap<>();

    for (int partsCnt = assignment.size(), p = 0; p < partsCnt; p++) {
        // Use the first node as primary, other - backups.
        Map<UUID, Set<Integer>> tmp = tmpPrm;
        Map<UUID, Set<Integer>> map = primary;

        for (ClusterNode node : assignment.get(p)) {
            UUID id = node.id();

            Set<Integer> set = tmp.get(id);

            if (set == null) {
                tmp.put(id, set = new HashSet<>());
                map.put(id, Collections.unmodifiableSet(set));
            }

            set.add(p);

            // Use the first node as primary, other - backups.
            tmp = tmpBkp;
            map = backup;
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:32,代码来源:GridAffinityAssignment.java

示例9: validateRestartingCaches

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param node Joining node to validate.
 * @return Node validation result if there was an issue with the joining node, {@code null} otherwise.
 */
private IgniteNodeValidationResult validateRestartingCaches(ClusterNode node) {
    if (cachesInfo.hasRestartingCaches()) {
        String msg = "Joining node during caches restart is not allowed [joiningNodeId=" + node.id() +
            ", restartingCaches=" + new HashSet<>(cachesInfo.restartingCaches()) + ']';

        return new IgniteNodeValidationResult(node.id(), msg, msg);
    }

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:GridCacheProcessor.java

示例10: validateHashIdResolvers

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param node Joining node.
 * @return Validation result or {@code null} in case of success.
 */
@Nullable private IgniteNodeValidationResult validateHashIdResolvers(ClusterNode node) {
    if (!node.isClient()) {
        for (DynamicCacheDescriptor desc : cacheDescriptors().values()) {
            CacheConfiguration cfg = desc.cacheConfiguration();

            if (cfg.getAffinity() instanceof RendezvousAffinityFunction) {
                RendezvousAffinityFunction aff = (RendezvousAffinityFunction)cfg.getAffinity();

                Object nodeHashObj = aff.resolveNodeHash(node);

                for (ClusterNode topNode : ctx.discovery().allNodes()) {
                    Object topNodeHashObj = aff.resolveNodeHash(topNode);

                    if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) {
                        String errMsg = "Failed to add node to topology because it has the same hash code for " +
                            "partitioned affinity as one of existing nodes [cacheName=" +
                            cfg.getName() + ", existingNodeId=" + topNode.id() + ']';

                        String sndMsg = "Failed to add node to topology because it has the same hash code for " +
                            "partitioned affinity as one of existing nodes [cacheName=" +
                            cfg.getName() + ", existingNodeId=" + topNode.id() + ']';

                        return new IgniteNodeValidationResult(topNode.id(), errMsg, sndMsg);
                    }
                }
            }
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:36,代码来源:GridCacheProcessor.java

示例11: checkTransactionConfiguration

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param rmt Remote node to check.
 * @throws IgniteCheckedException If check failed.
 */
private void checkTransactionConfiguration(ClusterNode rmt) throws IgniteCheckedException {
    TransactionConfiguration txCfg = rmt.attribute(ATTR_TX_CONFIG);

    if (txCfg != null) {
        TransactionConfiguration locTxCfg = ctx.config().getTransactionConfiguration();

        if (locTxCfg.isTxSerializableEnabled() != txCfg.isTxSerializableEnabled())
            throw new IgniteCheckedException("Serializable transactions enabled mismatch " +
                "(fix txSerializableEnabled property or set -D" + IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true " +
                "system property) [rmtNodeId=" + rmt.id() +
                ", locTxSerializableEnabled=" + locTxCfg.isTxSerializableEnabled() +
                ", rmtTxSerializableEnabled=" + txCfg.isTxSerializableEnabled() + ']');
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:GridCacheProcessor.java

示例12: checkMemoryConfiguration

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param rmt Remote node to check.
 * @throws IgniteCheckedException If check failed.
 */
private void checkMemoryConfiguration(ClusterNode rmt) throws IgniteCheckedException {
    ClusterNode locNode = ctx.discovery().localNode();

    if (ctx.config().isClientMode() || locNode.isDaemon() || rmt.isClient() || rmt.isDaemon())
        return;

    DataStorageConfiguration dsCfg = null;

    Object dsCfgBytes = rmt.attribute(IgniteNodeAttributes.ATTR_DATA_STORAGE_CONFIG);

    if (dsCfgBytes instanceof byte[])
        dsCfg = new JdkMarshaller().unmarshal((byte[])dsCfgBytes, U.resolveClassLoader(ctx.config()));

    if (dsCfg == null) {
        // Try to use legacy memory configuration.
        MemoryConfiguration memCfg = rmt.attribute(IgniteNodeAttributes.ATTR_MEMORY_CONFIG);

        if (memCfg != null) {
            dsCfg = new DataStorageConfiguration();

            // All properties that are used in validation should be converted here.
            dsCfg.setPageSize(memCfg.getPageSize());
        }
    }

    if (dsCfg != null) {
        DataStorageConfiguration locDsCfg = ctx.config().getDataStorageConfiguration();

        if (dsCfg.getPageSize() != locDsCfg.getPageSize()) {
            throw new IgniteCheckedException("Memory configuration mismatch (fix configuration or set -D" +
                IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK + "=true system property) [rmtNodeId=" + rmt.id() +
                ", locPageSize = " + locDsCfg.getPageSize() + ", rmtPageSize = " + dsCfg.getPageSize() + "]");
        }
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:40,代码来源:GridCacheProcessor.java

示例13: firstBalancedNodeIndex

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param firstNode First node which was return by balancer.
 * @param orderedNodes Balancing nodes.
 * @return Index of first node which was return by balancer.
 */
static int firstBalancedNodeIndex(ClusterNode firstNode, List<UUID> orderedNodes) {
    int startIdx = -1;

    for (int i = 0; i < orderedNodes.size(); i++) {
        if (firstNode.id() == orderedNodes.get(i))
            startIdx = i;
    }

    assertTrue("Can't find position of first balanced node", startIdx >= 0);

    return startIdx;
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:GridRoundRobinTestUtils.java

示例14: onNextPage

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
/**
 * @param node Node.
 * @param msg Message.
 */
private void onNextPage(final ClusterNode node, GridQueryNextPageResponse msg) {
    final long qryReqId = msg.queryRequestId();
    final int qry = msg.query();
    final int seg = msg.segmentId();

    final ReduceQueryRun r = runs.get(qryReqId);

    if (r == null) // Already finished with error or canceled.
        return;

    final int pageSize = r.pageSize();

    GridMergeIndex idx = r.indexes().get(msg.query());

    GridResultPage page;

    try {
        page = new GridResultPage(ctx, node.id(), msg) {
            @Override public void fetchNextPage() {
                Object errState = r.state();

                if (errState != null) {
                    CacheException err0 = errState instanceof CacheException ? (CacheException)errState : null;

                    if (err0 != null && err0.getCause() instanceof IgniteClientDisconnectedException)
                        throw err0;

                    CacheException e = new CacheException("Failed to fetch data from node: " + node.id());

                    if (err0 != null)
                        e.addSuppressed(err0);

                    throw e;
                }

                try {
                    GridQueryNextPageRequest msg0 = new GridQueryNextPageRequest(qryReqId, qry, seg, pageSize);

                    if (node.isLocal())
                        h2.mapQueryExecutor().onMessage(ctx.localNodeId(), msg0);
                    else
                        ctx.io().sendToGridTopic(node, GridTopic.TOPIC_QUERY, msg0, GridIoPolicy.QUERY_POOL);
                }
                catch (IgniteCheckedException e) {
                    throw new CacheException("Failed to fetch data from node: " + node.id(), e);
                }
            }
        };
    }
    catch (Exception e) {
        U.error(log, "Error in message.", e);

        fail(r, node.id(), "Error in message.", GridQueryFailResponse.GENERAL_ERROR);

        return;
    }

    idx.addPage(page);

    if (msg.retry() != null)
        retry(r, msg.retry(), node.id());
    else if (msg.page() == 0) // Do count down on each first page received.
        r.latch().countDown();
}
 
开发者ID:apache,项目名称:ignite,代码行数:69,代码来源:GridReduceQueryExecutor.java

示例15: apply

import org.apache.ignite.cluster.ClusterNode; //导入方法依赖的package包/类
@Nullable @Override public UUID apply(ClusterNode node) {
    return node != null ? node.id() : null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:4,代码来源:PlatformAffinity.java


注:本文中的org.apache.ignite.cluster.ClusterNode.id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。