Search in sources :

Example 1 with TcpDiscoveryNode

use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode in project ignite by apache.

the class ClientImpl method allVisibleNodes.

/**
     * @return All nodes.
     */
private NavigableSet<ClusterNode> allVisibleNodes() {
    NavigableSet<ClusterNode> allNodes = new TreeSet<>();
    for (TcpDiscoveryNode node : rmtNodes.values()) {
        if (node.visible())
            allNodes.add(node);
    }
    allNodes.add(locNode);
    return allNodes;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) TreeSet(java.util.TreeSet) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)

Example 2 with TcpDiscoveryNode

use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode in project ignite by apache.

the class ClientImpl method failNode.

/** {@inheritDoc} */
@Override
public void failNode(UUID nodeId, @Nullable String warning) {
    TcpDiscoveryNode node = rmtNodes.get(nodeId);
    if (node != null) {
        TcpDiscoveryNodeFailedMessage msg = new TcpDiscoveryNodeFailedMessage(getLocalNodeId(), node.id(), node.internalOrder());
        msg.warning(warning);
        msg.force(true);
        msgWorker.addMessage(msg);
    }
}
Also used : TcpDiscoveryNodeFailedMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)

Example 3 with TcpDiscoveryNode

use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode in project ignite by apache.

the class ServerImpl method failNode.

/** {@inheritDoc} */
@Override
public void failNode(UUID nodeId, @Nullable String warning) {
    TcpDiscoveryNode node = ring.node(nodeId);
    if (node != null) {
        TcpDiscoveryNodeFailedMessage msg = new TcpDiscoveryNodeFailedMessage(getLocalNodeId(), node.id(), node.internalOrder());
        msg.warning(warning);
        msg.force(true);
        msgWorker.addMessage(msg);
    }
}
Also used : TcpDiscoveryNodeFailedMessage(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)

Example 4 with TcpDiscoveryNode

use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode in project ignite by apache.

the class ServerImpl method getNode.

/** {@inheritDoc} */
@Nullable
@Override
public ClusterNode getNode(UUID nodeId) {
    assert nodeId != null;
    UUID locNodeId0 = getLocalNodeId();
    if (locNodeId0 != null && locNodeId0.equals(nodeId))
        // Return local node directly.
        return locNode;
    TcpDiscoveryNode node = ring.node(nodeId);
    if (node != null && !node.visible())
        return null;
    return node;
}
Also used : UUID(java.util.UUID) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with TcpDiscoveryNode

use of org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode in project ignite by apache.

the class ServerImpl method printStatistics.

/**
     * Prints SPI statistics.
     */
private void printStatistics() {
    if (log.isInfoEnabled() && spi.statsPrintFreq > 0) {
        int failedNodesSize;
        int leavingNodesSize;
        int joiningNodesSize;
        int pendingCustomMsgsSize;
        synchronized (mux) {
            failedNodesSize = failedNodes.size();
            leavingNodesSize = leavingNodes.size();
            joiningNodesSize = joiningNodes.size();
            pendingCustomMsgsSize = pendingCustomMsgs.size();
        }
        Runtime runtime = Runtime.getRuntime();
        TcpDiscoveryNode coord = resolveCoordinator();
        log.info("Discovery SPI statistics [statistics=" + spi.stats + ", spiState=" + spiStateCopy() + ", coord=" + coord + ", next=" + (msgWorker != null ? msgWorker.next : "N/A") + ", intOrder=" + (locNode != null ? locNode.internalOrder() : "N/A") + ", topSize=" + ring.allNodes().size() + ", leavingNodesSize=" + leavingNodesSize + ", failedNodesSize=" + failedNodesSize + ", joiningNodesSize=" + joiningNodesSize + ", pendingCustomMsgs=" + pendingCustomMsgsSize + ", msgWorker.queue.size=" + (msgWorker != null ? msgWorker.queueSize() : "N/A") + ", clients=" + ring.clientNodes().size() + ", clientWorkers=" + clientMsgWorkers.size() + ", lastUpdate=" + (locNode != null ? U.format(locNode.lastUpdateTime()) : "N/A") + ", heapFree=" + runtime.freeMemory() / (1024 * 1024) + "M, heapTotal=" + runtime.maxMemory() / (1024 * 1024) + "M]");
    }
}
Also used : TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)

Aggregations

TcpDiscoveryNode (org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)31 ClusterNode (org.apache.ignite.cluster.ClusterNode)9 Ignite (org.apache.ignite.Ignite)8 UUID (java.util.UUID)7 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)7 IOException (java.io.IOException)6 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)5 ArrayList (java.util.ArrayList)4 DiscoveryEvent (org.apache.ignite.events.DiscoveryEvent)4 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)4 Nullable (org.jetbrains.annotations.Nullable)4 Socket (java.net.Socket)3 SocketTimeoutException (java.net.SocketTimeoutException)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 IgniteException (org.apache.ignite.IgniteException)3 Event (org.apache.ignite.events.Event)3 TcpDiscoveryJoinRequestMessage (org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage)3 StreamCorruptedException (java.io.StreamCorruptedException)2 InetSocketAddress (java.net.InetSocketAddress)2 Collection (java.util.Collection)2