Class TcpDiscoverySpi

    • Field Detail

      • ATTR_EXT_ADDRS

        public static final String ATTR_EXT_ADDRS
        Node attribute that is mapped to node's external addresses (value is disc.tcp.ext-addrs).
        See Also:
        Constant Field Values
      • DFLT_PORT_RANGE

        public static final int DFLT_PORT_RANGE
        Default local port range (value is 100).
        See Also:
        Constant Field Values
      • DFLT_PORT

        public static final int DFLT_PORT
        Default port to listen (value is 47500).
        See Also:
        Constant Field Values
      • DFLT_JOIN_TIMEOUT

        public static final long DFLT_JOIN_TIMEOUT
        Default timeout for joining topology (value is 0).
        See Also:
        Constant Field Values
      • DFLT_NETWORK_TIMEOUT

        public static final long DFLT_NETWORK_TIMEOUT
        Default network timeout in milliseconds (value is 5000ms).
        See Also:
        Constant Field Values
      • DFLT_THREAD_PRI

        public static final int DFLT_THREAD_PRI
        Default value for thread priority (value is 10).
        See Also:
        Constant Field Values
      • DFLT_TOP_HISTORY_SIZE

        public static final int DFLT_TOP_HISTORY_SIZE
        Default size of topology snapshots history.
        See Also:
        Constant Field Values
      • DFLT_SOCK_TIMEOUT

        public static final long DFLT_SOCK_TIMEOUT
        Default socket operations timeout in milliseconds (value is 5000ms).
        See Also:
        Constant Field Values
      • DFLT_ACK_TIMEOUT

        public static final long DFLT_ACK_TIMEOUT
        Default timeout for receiving message acknowledgement in milliseconds (value is 5000ms).
        See Also:
        Constant Field Values
      • DFLT_SOCK_TIMEOUT_CLIENT

        public static final long DFLT_SOCK_TIMEOUT_CLIENT
        Default socket operations timeout in milliseconds (value is 5000ms).
        See Also:
        Constant Field Values
      • DFLT_ACK_TIMEOUT_CLIENT

        public static final long DFLT_ACK_TIMEOUT_CLIENT
        Default timeout for receiving message acknowledgement in milliseconds (value is 5000ms).
        See Also:
        Constant Field Values
      • DFLT_RECONNECT_CNT

        public static final int DFLT_RECONNECT_CNT
        Default reconnect attempts count (value is 10).
        See Also:
        Constant Field Values
      • DFLT_RECONNECT_DELAY

        public static final long DFLT_RECONNECT_DELAY
        Default delay between attempts to connect to the cluster in milliseconds (value is 2000).
        See Also:
        Constant Field Values
      • DFLT_IP_FINDER_CLEAN_FREQ

        public static final long DFLT_IP_FINDER_CLEAN_FREQ
        Default IP finder clean frequency in milliseconds (value is 60,000ms).
        See Also:
        Constant Field Values
      • DFLT_STATS_PRINT_FREQ

        public static final long DFLT_STATS_PRINT_FREQ
        Default statistics print frequency in milliseconds (value is 0ms).
        See Also:
        Constant Field Values
      • DFLT_MAX_ACK_TIMEOUT

        public static final long DFLT_MAX_ACK_TIMEOUT
        Maximum ack timeout value for receiving message acknowledgement in milliseconds (value is 600,000ms).
        See Also:
        Constant Field Values
      • DFLT_SO_LINGER

        public static final int DFLT_SO_LINGER
        Default SO_LINGER to set for socket, 0 means enabled with 0 timeout.
        See Also:
        Constant Field Values
      • DFLT_CONNECTION_RECOVERY_TIMEOUT

        public static final long DFLT_CONNECTION_RECOVERY_TIMEOUT
        Default connection recovery timeout in ms.
      • locAddr

        protected String locAddr
        Local address.
      • netTimeout

        protected long netTimeout
        Network timeout.
      • joinTimeout

        protected long joinTimeout
        Join timeout, in milliseconds. Time to wait for joining. If node cannot connect to any address from the IP finder, the node continues to try to join during this timeout. If all addresses still do not respond, an exception will occur and the node will fail to start. If 0 is specified, it means wait forever.
      • threadPri

        protected int threadPri
        Thread priority for all threads started by SPI.
      • metricsUpdateFreq

        protected long metricsUpdateFreq
        Metrics update messages issuing frequency.
      • topHistSize

        protected int topHistSize
        Size of topology snapshots history.
      • connRecoveryTimeout

        protected long connRecoveryTimeout
        Default connection recovery timeout in ms.
      • locNodeAttrs

        protected Map<String,​Object> locNodeAttrs
        Local node attributes.
      • locNode

        protected org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode locNode
        Local node.
      • cfgNodeId

        protected UUID cfgNodeId
      • gridStartTime

        protected volatile long gridStartTime
        Start time of the very first grid node.
      • stats

        protected final org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatistics stats
        Statistics.
      • locPort

        protected int locPort
        Local port which node uses.
      • locPortRange

        protected int locPortRange
        Local port range.
      • statsPrintFreq

        protected long statsPrintFreq
        Statistics print frequency.
      • ipFinderCleanFreq

        protected long ipFinderCleanFreq
        The frequency with which coordinator cleans IP finder and keeps it in the correct state, which means that coordinator unregisters addresses of the nodes that have left the topology and re-registries missing addresses.
        See Also:
        ServerImpl.IpFinderCleaner
      • sslEnable

        protected boolean sslEnable
        SSL enable/disable flag.
      • impl

        protected org.apache.ignite.spi.discovery.tcp.TcpDiscoveryImpl impl
    • Constructor Detail

      • TcpDiscoverySpi

        public TcpDiscoverySpi()
    • Method Detail

      • getSpiState

        public String getSpiState()
        Gets current SPI state.
        Returns:
        Current SPI state.
      • getMessageWorkerQueueSize

        public int getMessageWorkerQueueSize()
        Gets message worker queue current size.
        Returns:
        Message worker queue current size.
      • getCoordinator

        public UUID getCoordinator()
        Gets current coordinator.
        Returns:
        Gets current coordinator.
      • getRemoteNodes

        public Collection<ClusterNode> getRemoteNodes()
        Gets collection of remote nodes in grid or empty collection if no remote nodes found.
        Specified by:
        getRemoteNodes in interface DiscoverySpi
        Returns:
        Collection of remote nodes.
      • getNode

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

        public ClusterNode getNode0​(UUID id)
        Parameters:
        id - Id.
        Returns:
        Cluster node instance with specified ID.
      • pingNode

        public boolean pingNode​(UUID nodeId)
        Pings the remote node to see if it's alive.
        Specified by:
        pingNode in interface DiscoverySpi
        Parameters:
        nodeId - Node Id.
        Returns:
        true if node alive, false otherwise.
      • failNode

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

        public void dumpDebugInfo()
        Dumps debug info using configured logger.
      • isClientMode

        public boolean isClientMode()
        Whether or not discovery is started in client mode.
        Specified by:
        isClientMode in interface DiscoverySpi
        Returns:
        true if node is in client mode.
      • isForceServerMode

        @Deprecated
        public boolean isForceServerMode()
        Deprecated.
        Will be removed at 3.0.
        If true TcpDiscoverySpi will started in server mode regardless of IgniteConfiguration.isClientMode()
        Returns:
        forceServerMode flag.
      • isClientReconnectDisabled

        public boolean isClientReconnectDisabled()
        If true client does not try to reconnect after server detected client node failure.
        Returns:
        Client reconnect disabled flag.
      • setClientReconnectDisabled

        @IgniteSpiConfiguration(optional=true)
        public void setClientReconnectDisabled​(boolean clientReconnectDisabled)
        Sets client reconnect disabled flag.

        If true client does not try to reconnect after server detected client node failure.

        Parameters:
        clientReconnectDisabled - Client reconnect disabled flag.
      • getLocalAddress

        public String getLocalAddress()
        Gets local address that was set to SPI with setLocalAddress(String) method.
        Returns:
        local address.
      • getAddressResolver

        public AddressResolver getAddressResolver()
        Gets address resolver.
        Returns:
        Address resolver.
      • getReconnectCount

        public int getReconnectCount()
        Gets number of connection attempts.
        Returns:
        Number of connection attempts.
      • getReconnectDelay

        public long getReconnectDelay()
        Gets the amount of time in milliseconds that node waits before retrying to (re)connect to the cluster.
        Returns:
        Delay between attempts to connect to the cluster in milliseconds.
      • setReconnectDelay

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setReconnectDelay​(int reconDelay)
        Sets the amount of time in milliseconds that node waits before retrying to (re)connect to the cluster.

        If not specified, default is DFLT_RECONNECT_DELAY.

        Parameters:
        reconDelay - Delay between attempts to connect to the cluster in milliseconds.
        Returns:
        this for chaining.
      • getMaxAckTimeout

        public long getMaxAckTimeout()
        Gets maximum message acknowledgement timeout.
        Returns:
        Maximum message acknowledgement timeout.
      • setMaxAckTimeout

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setMaxAckTimeout​(long maxAckTimeout)
        Sets maximum timeout for receiving acknowledgement for sent message.

        If acknowledgement is not received within this timeout, sending is considered as failed and SPI tries to repeat message sending. Every time SPI retries messing sending, ack timeout will be increased. If no acknowledgement is received and maxAckTimeout is reached, then the process of message sending is considered as failed.

        If not specified, default is DFLT_MAX_ACK_TIMEOUT.

        Affected server nodes only.

        When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout() is ignored.

        Parameters:
        maxAckTimeout - Maximum acknowledgement timeout.
        Returns:
        this for chaining.
      • getLocalPort

        public int getLocalPort()
        Gets local TCP port SPI listens to.
        Returns:
        Local port range.
      • setLocalPort

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setLocalPort​(int locPort)
        Sets local port to listen to.

        If not specified, default is DFLT_PORT.

        Affected server nodes only.

        Parameters:
        locPort - Local port to bind.
        Returns:
        this for chaining.
      • getLocalPortRange

        public int getLocalPortRange()
        Gets local TCP port range.
        Returns:
        Local port range.
      • setLocalPortRange

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setLocalPortRange​(int locPortRange)
        Range for local ports. Local node will try to bind on first available port starting from getLocalPort() up until getLocalPort() + locPortRange. If port range value is 0, then implementation will try bind only to the port provided by setLocalPort(int) method and fail if binding to this port did not succeed.

        If not specified, default is DFLT_PORT_RANGE.

        Affected server nodes only.

        Parameters:
        locPortRange - Local port range to bind.
        Returns:
        this for chaining.
      • getStatisticsPrintFrequency

        public long getStatisticsPrintFrequency()
        Gets statistics print frequency.
        Returns:
        Statistics print frequency in milliseconds.
      • setStatisticsPrintFrequency

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setStatisticsPrintFrequency​(long statsPrintFreq)
        Sets statistics print frequency.

        If not set default value is DFLT_STATS_PRINT_FREQ. 0 indicates that no print is required. If value is greater than 0 and log is not quiet then statistics are printed out with INFO level.

        This may be very helpful for tracing topology problems.

        Parameters:
        statsPrintFreq - Statistics print frequency in milliseconds.
        Returns:
        this for chaining.
      • getIpFinderCleanFrequency

        public long getIpFinderCleanFrequency()
        Gets frequency with which coordinator cleans IP finder and keeps it in the correct state, unregistering addresses of the nodes that have left the topology.
        Returns:
        IP finder clean frequency.
      • setIpFinderCleanFrequency

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setIpFinderCleanFrequency​(long ipFinderCleanFreq)
        Sets IP finder clean frequency in milliseconds.

        If not provided, default value is DFLT_IP_FINDER_CLEAN_FREQ

        Affected server nodes only.

        Parameters:
        ipFinderCleanFreq - IP finder clean frequency.
        Returns:
        this for chaining.
      • getIpFinder

        public TcpDiscoveryIpFinder getIpFinder()
        Gets IP finder for IP addresses sharing and storing.
        Returns:
        IP finder for IP addresses sharing and storing.
      • setSoLinger

        @IgniteSpiConfiguration(optional=true)
        public void setSoLinger​(int soLinger)
        Sets SO_LINGER to use for all created sockets.

        If not specified, default is DFLT_SO_LINGER

        Parameters:
        soLinger - SO_LINGER value.
      • getJoinTimeout

        public long getJoinTimeout()
        Get join timeout, in milliseconds. Time to wait for joining. If node cannot connect to any address from the IP finder, the node continues to try to join during this timeout. If all addresses still do not respond, an exception will occur and the node will fail to start. If 0 is specified, it means wait forever.
        Returns:
        Join timeout.
      • setJoinTimeout

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setJoinTimeout​(long joinTimeout)
        Sets join timeout.

        If non-shared IP finder is used and node fails to connect to any address from IP finder, node keeps trying to join within this timeout. If all addresses are still unresponsive, exception is thrown and node startup fails.

        If not specified, default is DFLT_JOIN_TIMEOUT.

        Parameters:
        joinTimeout - Join timeout (0 means wait forever).
        Returns:
        this for chaining.
        See Also:
        TcpDiscoveryIpFinder.isShared()
      • setThreadPriority

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setThreadPriority​(int threadPri)
        Sets thread priority. All threads within SPI will be started with it.

        If not provided, default value is DFLT_THREAD_PRI

        Parameters:
        threadPri - Thread priority.
        Returns:
        this for chaining.
      • getTopHistorySize

        public long getTopHistorySize()
        Returns:
        Size of topology snapshots history.
      • setTopHistorySize

        @IgniteSpiConfiguration(optional=true)
        public TcpDiscoverySpi setTopHistorySize​(int topHistSize)
        Sets size of topology snapshots history. Specified size should be greater than or equal to default size DFLT_TOP_HISTORY_SIZE.
        Parameters:
        topHistSize - Size of topology snapshots history.
        Returns:
        this for chaining.
      • getConnectionRecoveryTimeout

        public long getConnectionRecoveryTimeout()
        Gets timeout that defines how long server node would try to recovery connection.
        See setConnectionRecoveryTimeout(long) for details.
        Returns:
        Timeout that defines how long server node would try to recovery connection.
      • setConnectionRecoveryTimeout

        public void setConnectionRecoveryTimeout​(long connRecoveryTimeout)
        Sets timeout that defines how long server node would try to recovery connection.

        In case local node has temporary connectivity issues with part of the cluster, it may sequentially fail nodes one-by-one till successfully connect to one that has a fine connection with. This leads to fail of big number of nodes.

        To overcome that issue, local node will do a sequential connection tries to next nodes. But if new next node has connection to previous it forces local node to retry connect to previous. These tries will last till timeout will not finished. When timeout is over, but no success in connecting to nodes it will segment itself.

        Cannot be greater than IgniteSpiAdapter.failureDetectionTimeout().

        Default is DFLT_CONNECTION_RECOVERY_TIMEOUT.

        Parameters:
        connRecoveryTimeout - Timeout that defines how long server node would try to recovery connection. 0 means node will not recheck failed nodes.
      • setNodeAttributes

        public 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
        Specified by:
        setNodeAttributes in interface DiscoverySpi
        Parameters:
        attrs - Map of node attributes.
        ver - Product version.
      • getLocalNodeId

        public UUID getLocalNodeId()
        Gets ID of the local node.
        Returns:
        ID of the local node.
      • initLocalNode

        protected void initLocalNode​(int srvPort,
                                     boolean addExtAddrAttr)
        Parameters:
        srvPort - Server port.
        addExtAddrAttr - If true adds ATTR_EXT_ADDRS attribute.
      • injectables

        public Collection<Object> injectables()
        This method returns SPI internal instances that need to be injected as well. Usually these will be instances provided to SPI externally by user, e.g. during SPI configuration.
        Overrides:
        injectables in class IgniteSpiAdapter
        Returns:
        Internal SPI objects that also need to be injected.
      • getSocketTimeout

        public long getSocketTimeout()
        Gets socket timeout.
        Returns:
        Socket timeout.
      • getEffectiveSocketTimeout

        public long getEffectiveSocketTimeout​(boolean srvrOperation)
        Gets effective or resulting socket timeout with considering failure detection timeout
        Parameters:
        srvrOperation - True if socket connect to server node, False if socket connect to client node.
        Returns:
        Resulting socket timeout.
      • getAckTimeout

        public long getAckTimeout()
        Gets message acknowledgement timeout.
        Returns:
        Message acknowledgement timeout.
      • getSoLinger

        public int getSoLinger()
        Gets SO_LINGER timeout for socket.
        Returns:
        SO_LINGER timeout for socket.
      • getNetworkTimeout

        public long getNetworkTimeout()
        Gets network timeout.
        Returns:
        Network timeout.
      • getThreadPriority

        public int getThreadPriority()
        Gets thread priority. All threads within SPI will be started with it.
        Returns:
        Thread priority.
      • getIpFinderFormatted

        public String getIpFinderFormatted()
        Gets TcpDiscoveryIpFinder (string representation).
        Returns:
        IPFinder (string representation).
      • getNodesJoined

        public long getNodesJoined()
        Gets joined nodes count.
        Returns:
        Nodes joined count.
      • getNodesLeft

        public long getNodesLeft()
        Gets left nodes count.
        Returns:
        Left nodes count.
      • getNodesFailed

        public long getNodesFailed()
        Gets failed nodes count.
        Returns:
        Failed nodes count.
      • getPendingMessagesRegistered

        public long getPendingMessagesRegistered()
        Gets pending messages registered count.
        Returns:
        Pending messages registered count.
      • getPendingMessagesDiscarded

        public long getPendingMessagesDiscarded()
        Gets pending messages discarded count.
        Returns:
        Pending messages registered count.
      • getAvgMessageProcessingTime

        public long getAvgMessageProcessingTime()
        Gets avg message processing time.
        Returns:
        Avg message processing time.
      • getMaxMessageProcessingTime

        public long getMaxMessageProcessingTime()
        Gets max message processing time.
        Returns:
        Max message processing time.
      • getTotalReceivedMessages

        public int getTotalReceivedMessages()
        Gets total received messages count.
        Returns:
        Total received messages count.
      • getReceivedMessages

        public Map<String,​Integer> getReceivedMessages()
        Gets received messages counts (grouped by type).
        Returns:
        Map containing message types and respective counts.
      • getTotalProcessedMessages

        public int getTotalProcessedMessages()
        Gets total processed messages count.
        Returns:
        Total processed messages count.
      • getProcessedMessages

        public Map<String,​Integer> getProcessedMessages()
        Gets processed messages counts (grouped by type).
        Returns:
        Map containing message types and respective counts.
      • getCoordinatorSinceTimestamp

        public long getCoordinatorSinceTimestamp()
        Gets time local node has been coordinator since.
        Returns:
        Time local node is coordinator since.
      • onContextDestroyed0

        protected void onContextDestroyed0()
        Method to be called in the beginning of onContextDestroyed() method.
        Overrides:
        onContextDestroyed0 in class IgniteSpiAdapter
      • setListener

        public void setListener​(@Nullable
                                @Nullable DiscoverySpiListener lsnr)
        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

        Specified by:
        setListener in interface DiscoverySpi
        Parameters:
        lsnr - Listener to discovery events or null to unset the listener.
      • setDataExchange

        public void setDataExchange​(DiscoverySpiDataExchange exchange)
        Sets a handler for initial data exchange between Ignite nodes.
        Specified by:
        setDataExchange in interface DiscoverySpi
        Parameters:
        exchange - Discovery data exchange handler.
      • getGridStartTime

        public 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.
        Specified by:
        getGridStartTime in interface DiscoverySpi
        Returns:
        Start time of the first node in grid or 0 if SPI implementation does not support this method.
      • writeToSocket

        protected void writeToSocket​(Socket sock,
                                     org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg,
                                     byte[] data,
                                     long timeout)
                              throws IOException
        Writes message to the socket.
        Parameters:
        sock - Socket.
        msg - Message.
        data - Raw data to write.
        timeout - Socket write timeout.
        Throws:
        IOException - If IO failed or write timed out.
      • writeToSocket

        protected void writeToSocket​(Socket sock,
                                     org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg,
                                     long timeout)
                              throws IOException,
                                     IgniteCheckedException
        Writes message to the socket.
        Parameters:
        sock - Socket.
        msg - Message.
        timeout - Socket write timeout.
        Throws:
        IOException - If IO failed or write timed out.
        IgniteCheckedException - If marshalling failed.
      • startMessageProcess

        @TestOnly
        protected void startMessageProcess​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg)
        Parameters:
        msg - Message.
      • writeToSocket

        protected void writeToSocket​(Socket sock,
                                     OutputStream out,
                                     org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg,
                                     long timeout)
                              throws IOException,
                                     IgniteCheckedException
        Writes message to the socket.
        Parameters:
        sock - Socket.
        out - Stream to write to.
        msg - Message.
        timeout - Timeout.
        Throws:
        IOException - If IO failed or write timed out.
        IgniteCheckedException - If marshalling failed.
      • writeToSocket

        protected void writeToSocket​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg,
                                     Socket sock,
                                     int res,
                                     long timeout)
                              throws IOException
        Writes response to the socket.
        Parameters:
        msg - Received message.
        sock - Socket.
        res - Integer response.
        timeout - Socket timeout.
        Throws:
        IOException - If IO failed or write timed out.
      • readMessage

        protected <T> T readMessage​(Socket sock,
                                    @Nullable
                                    @Nullable InputStream in,
                                    long timeout)
                             throws IOException,
                                    IgniteCheckedException
        Reads message from the socket limiting read time.
        Parameters:
        sock - Socket.
        in - Input stream (in case socket stream was wrapped).
        timeout - Socket timeout for this operation.
        Returns:
        Message.
        Throws:
        IOException - If IO failed or read timed out.
        IgniteCheckedException - If unmarshalling failed.
      • readReceipt

        protected int readReceipt​(Socket sock,
                                  long timeout)
                           throws IOException
        Reads message delivery receipt from the socket.
        Parameters:
        sock - Socket.
        timeout - Socket timeout for this operation.
        Returns:
        Receipt.
        Throws:
        IOException - If IO failed or read timed out.
      • resolvedAddresses

        protected Collection<InetSocketAddress> resolvedAddresses()
                                                           throws IgniteSpiException
        Resolves addresses registered in the IP finder, removes duplicates and local host address and returns the collection of.
        Returns:
        Resolved addresses without duplicates and local address (potentially empty but never null).
        Throws:
        IgniteSpiException - If an error occurs.
      • duplicateIdError

        protected IgniteSpiException duplicateIdError​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage msg)
        Parameters:
        msg - Message.
        Returns:
        Error.
      • authenticationFailedError

        protected IgniteSpiException authenticationFailedError​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage msg)
        Parameters:
        msg - Message.
        Returns:
        Error.
      • checkFailedError

        protected IgniteSpiException checkFailedError​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage msg)
        Parameters:
        msg - Message.
        Returns:
        Error.
      • ensured

        protected boolean ensured​(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg)
        Parameters:
        msg - Message.
        Returns:
        Whether delivery of the message is ensured.
      • onExchange

        protected void onExchange​(org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket dataPacket,
                                  ClassLoader clsLdr)
        Parameters:
        dataPacket - object holding discovery data collected during discovery process.
        clsLdr - Class loader.
      • spiStart

        public void spiStart​(@Nullable
                             @Nullable String igniteInstanceName)
                      throws IgniteSpiException
        This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.
        Specified by:
        spiStart in interface IgniteSpi
        Parameters:
        igniteInstanceName - Name of Ignite instance this SPI is being started for (null for default Ignite instance).
        Throws:
        IgniteSpiException - Throws in case of any error during SPI start.
      • initializeImpl

        protected void initializeImpl()
      • spiStop

        public void spiStop()
                     throws IgniteSpiException
        This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.

        Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.

        Specified by:
        spiStop in interface IgniteSpi
        Throws:
        IgniteSpiException - Thrown in case of any error during SPI stop.
      • clientReconnect

        public void clientReconnect()
                             throws IgniteSpiException
        Specified by:
        clientReconnect in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Throws:
        IgniteSpiException
      • allNodesSupport

        public boolean allNodesSupport​(org.apache.ignite.internal.IgniteFeatures feature)
        Specified by:
        allNodesSupport in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Parameters:
        feature - Feature to check.
        Returns:
        true if all nodes support the given feature.
      • knownNode

        public boolean knownNode​(UUID nodeId)
        Specified by:
        knownNode in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Parameters:
        nodeId - Node ID.
        Returns:
        True if node joining or already joined topology.
      • clientReconnectSupported

        public boolean clientReconnectSupported()
        Specified by:
        clientReconnectSupported in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Returns:
        True if SPI supports client reconnect.
      • supportsCommunicationFailureResolve

        public boolean supportsCommunicationFailureResolve()
        Specified by:
        supportsCommunicationFailureResolve in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Returns:
        True if supports communication error resolve.
      • resolveCommunicationFailure

        public void resolveCommunicationFailure​(ClusterNode node,
                                                Exception err)
        Specified by:
        resolveCommunicationFailure in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Parameters:
        node - Problem node.
        err - Connection error.
      • clientWorkerCount

        public int clientWorkerCount()
        FOR TEST ONLY!!!
        Returns:
        Client workers count.
      • addSendMessageListener

        public void addSendMessageListener​(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr)
        FOR TEST ONLY!!!
        Parameters:
        lsnr - Listener of sent messages.
      • setInternalListener

        public void setInternalListener​(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr)
        For TESTING only.
        Specified by:
        setInternalListener in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
        Parameters:
        lsnr - Listener.
      • removeSendMessageListener

        public void removeSendMessageListener​(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr)
        FOR TEST ONLY!!!
        Parameters:
        lsnr - Instance of the listener for sent messages.
      • addIncomeConnectionListener

        public void addIncomeConnectionListener​(IgniteInClosure<Socket> lsnr)
        FOR TEST ONLY!!!
        Parameters:
        lsnr - Instance of the listener for incoming messages.
      • removeIncomeConnectionListener

        public void removeIncomeConnectionListener​(IgniteInClosure<Socket> lsnr)
        FOR TEST ONLY!!!
        Parameters:
        lsnr - Instance of the listener for incoming messages.
      • waitForClientMessagePrecessed

        public void waitForClientMessagePrecessed()
        FOR TEST PURPOSE ONLY!
      • simulateNodeFailure

        public void simulateNodeFailure()
        FOR TEST ONLY!!!

        Simulates this node failure by stopping service threads. So, node will become unresponsive.

        This method is intended for test purposes only.

        Specified by:
        simulateNodeFailure in interface org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
      • brakeConnection

        public void brakeConnection()
        FOR TEST PURPOSE ONLY!
      • isLocalNodeCoordinator

        public boolean isLocalNodeCoordinator()
        Checks whether local node is coordinator. Nodes that are leaving or failed (but are still in topology) are removed from search.
        Returns:
        true if local node is coordinator.
      • marshaller

        protected Marshaller marshaller()
        Returns:
        Marshaller.