Interface DiscoverySpi

  • All Superinterfaces:
    IgniteSpi
    All Known Implementing Classes:
    IsolatedDiscoverySpi, TcpDiscoverySpi, ZookeeperDiscoverySpi

    public interface DiscoverySpi
    extends IgniteSpi
    Grid discovery SPI allows to discover remote nodes in grid.

    The default discovery SPI is TcpDiscoverySpi with default configuration which allows all nodes in local network (with enabled multicast) to discover each other.

    Ignite provides the following GridDeploymentSpi implementation:

    NOTE: this SPI (i.e. methods in this interface) should never be used directly. SPIs provide internal view on the subsystem and is used internally by Ignite kernal. In rare use cases when access to a specific implementation of this SPI is required - an instance of this SPI can be obtained via Ignite.configuration() method to check its configuration properties or call other non-SPI methods. Note again that calling methods from this interface on the obtained instance can lead to undefined behavior and explicitly not supported.
    • Method Detail

      • getRemoteNodes

        Collection<ClusterNode> getRemoteNodes()
        Gets collection of remote nodes in grid or empty collection if no remote nodes found.
        Returns:
        Collection of remote nodes.
      • getLocalNode

        ClusterNode getLocalNode()
        Gets local node.
        Returns:
        Local node.
      • getNode

        @Nullable
        @Nullable ClusterNode getNode​(UUID nodeId)
        Gets node by ID.
        Parameters:
        nodeId - Node ID.
        Returns:
        Node with given ID or null if node is not found.
      • pingNode

        boolean pingNode​(UUID nodeId)
        Pings the remote node to see if it's alive.
        Parameters:
        nodeId - Node Id.
        Returns:
        true if node alive, false otherwise.
      • setNodeAttributes

        void setNodeAttributes​(Map<String,​Object> attrs,
                               IgniteProductVersion ver)
        Sets node attributes and node version which will be distributed in grid during join process. Note that these attributes cannot be changed and set only once. set
        Parameters:
        attrs - Map of node attributes.
        ver - Product version.
      • setListener

        @Deprecated
        void setListener​(@Nullable
                         @Nullable DiscoverySpiListener lsnr)
        Deprecated.
        Sets a listener for discovery events. Refer to DiscoveryEvent for a set of all possible discovery events.

        TODO: This method should be removed from public API in Apache Ignite 3.0

        Parameters:
        lsnr - Listener to discovery events or null to unset the listener.
      • setDataExchange

        void setDataExchange​(DiscoverySpiDataExchange exchange)
        Sets a handler for initial data exchange between Ignite nodes.
        Parameters:
        exchange - Discovery data exchange handler.
      • disconnect

        void disconnect()
                 throws IgniteSpiException
        Tells discovery SPI to disconnect from topology. This is very close to calling IgniteSpi.spiStop() with accounting that it is not a full stop, but disconnect due to segmentation.
        Throws:
        IgniteSpiException - If any error occurs.
      • setAuthenticator

        void setAuthenticator​(DiscoverySpiNodeAuthenticator auth)
        Sets discovery SPI node authenticator. This method is called before SPI start() method.
        Parameters:
        auth - Discovery SPI authenticator.
      • getGridStartTime

        long getGridStartTime()
        Gets start time of the very first node in the grid. This value should be the same on all nodes in the grid and it should not change even if very first node fails of leaves grid.
        Returns:
        Start time of the first node in grid or 0 if SPI implementation does not support this method.
      • failNode

        void failNode​(UUID nodeId,
                      @Nullable
                      @Nullable String warning)
        Initiates failure of provided node.
        Parameters:
        nodeId - Node ID.
        warning - Warning to be shown on all cluster nodes.
      • isClientMode

        boolean isClientMode()
                      throws IllegalStateException
        Whether or not discovery is started in client mode.
        Returns:
        true if node is in client mode.
        Throws:
        IllegalStateException - If discovery SPI has not started.