Class TcpDiscoverySpi
- java.lang.Object
- 
- org.apache.ignite.spi.IgniteSpiAdapter
- 
- org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
 
 
- 
- All Implemented Interfaces:
- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi,- DiscoverySpi,- IgniteSpi
 
 @IgniteSpiMultipleInstancesSupport(true) @DiscoverySpiOrderSupport(true) @DiscoverySpiHistorySupport(true) @DiscoverySpiMutableCustomMessageSupport(true) public class TcpDiscoverySpi extends IgniteSpiAdapter implements org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi Discovery SPI implementation that uses TCP/IP for node discovery.Nodes are organized in ring. So almost all network exchange (except few cases) is done across it. If node is configured as client node (see IgniteConfiguration.clientMode) TcpDiscoverySpi starts in client mode as well. In this case node does not take its place in the ring, but it connects to random node in the ring (IP taken from IP finder configured) and use it as a router for discovery traffic. Therefore slow client node or its shutdown will not affect whole cluster. If TcpDiscoverySpi needs to be started in server mode regardless ofIgniteConfiguration.clientMode,forceSrvModeshould be set to true.At startup SPI tries to send messages to random IP taken from TcpDiscoveryIpFinderabout self start (stops when send succeeds) and then this info goes to coordinator. When coordinator processes join request and issues node added messages and all other nodes then receive info about new node.Failure DetectionConfiguration defaults (see Configuration section below andIgniteConfiguration.getFailureDetectionTimeout()) for details) are chosen to make possible for discovery SPI work reliably on most of hardware and virtual deployments, but this has made failure detection time worse.If it's needed to tune failure detection then it's highly recommended to do this using IgniteConfiguration.setFailureDetectionTimeout(long). This failure timeout automatically controls the following parameters:getSocketTimeout(),getAckTimeout(),getMaxAckTimeout(),getReconnectCount(). If any of those parameters is set explicitly, then the failure timeout setting will be ignored. As an example, for stable low-latency networks the failure detection timeout may be set to ~120 ms.If it's required to perform advanced settings of failure detection and IgniteConfiguration.getFailureDetectionTimeout()is unsuitable then variousTcpDiscoverySpiconfiguration parameters may be used. As an example, for stable low-latency networks the following more aggressive settings are recommended (which allows failure detection time ~200ms):- Socket timeout (see setSocketTimeout(long)) - 200ms
- Message acknowledgement timeout (see setAckTimeout(long)) - 50ms
 ConfigurationMandatoryThere are no mandatory configuration parameters.OptionalThe following configuration parameters are optional:- IP finder to share info about nodes IP addresses
 (see setIpFinder(TcpDiscoveryIpFinder)). See the following IP finder implementations for details on configuration:
 - Local address (see setLocalAddress(String))
- Local port to bind to (see setLocalPort(int))
- Local port range to try binding to if previous ports are in use
      (see setLocalPortRange(int))
- Number of times node tries to (re)establish connection to another node
      (see setReconnectCount(int))
- Network timeout (see setNetworkTimeout(long))
- Socket timeout (see setSocketTimeout(long))
- Message acknowledgement timeout (see setAckTimeout(long))
- Maximum message acknowledgement timeout (see setMaxAckTimeout(long))
- Join timeout (see setJoinTimeout(long))
- Thread priority for threads started by SPI (see setThreadPriority(int))
- IP finder clean frequency (see setIpFinderCleanFrequency(long))
- Statistics print frequency (see setStatisticsPrintFrequency(long)
- Force server mode (see setForceServerMode(boolean)
 Java ExampleTcpDiscoverySpi spi = new TcpDiscoverySpi(); TcpDiscoveryVmIpFinder finder = new GridTcpDiscoveryVmIpFinder(); spi.setIpFinder(finder); IgniteConfiguration cfg = new IgniteConfiguration(); // Override default discovery SPI. cfg.setDiscoverySpi(spi); // Start grid. Ignition.start(cfg);Spring ExampleTcpDiscoverySpi can be configured from Spring XML configuration file:<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder" /> </property> </bean> </property> ... </bean>  
 For information about Spring framework visit www.springframework.org- See Also:
- DiscoverySpi
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringATTR_EXT_ADDRSNode attribute that is mapped to node's external addresses (value is disc.tcp.ext-addrs).protected UUIDcfgNodeIdprotected longconnRecoveryTimeoutDefault connection recovery timeout in ms.static longDFLT_ACK_TIMEOUTDefault timeout for receiving message acknowledgement in milliseconds (value is 5000ms).static longDFLT_ACK_TIMEOUT_CLIENTDefault timeout for receiving message acknowledgement in milliseconds (value is 5000ms).static longDFLT_CONNECTION_RECOVERY_TIMEOUTDefault connection recovery timeout in ms.static intDFLT_DISCO_FAILED_CLIENT_RECONNECT_DELAYstatic intDFLT_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZEstatic intDFLT_DISCOVERY_METRICS_QNT_WARNstatic longDFLT_IP_FINDER_CLEAN_FREQDefault IP finder clean frequency in milliseconds (value is 60,000ms).static longDFLT_JOIN_TIMEOUTDefault timeout for joining topology (value is 0).static longDFLT_MAX_ACK_TIMEOUTMaximum ack timeout value for receiving message acknowledgement in milliseconds (value is 600,000ms).static longDFLT_NETWORK_TIMEOUTDefault network timeout in milliseconds (value is 5000ms).static intDFLT_NODE_IDS_HISTORY_SIZEstatic intDFLT_PORTDefault port to listen (value is 47500).static intDFLT_PORT_RANGEDefault local port range (value is 100).static intDFLT_RECONNECT_CNTDefault reconnect attempts count (value is 10).static longDFLT_RECONNECT_DELAYDefault delay between attempts to connect to the cluster in milliseconds (value is 2000).static intDFLT_SO_LINGERDefault SO_LINGER to set for socket, 0 means enabled with 0 timeout.static longDFLT_SOCK_TIMEOUTDefault socket operations timeout in milliseconds (value is 5000ms).static longDFLT_SOCK_TIMEOUT_CLIENTDefault socket operations timeout in milliseconds (value is 5000ms).static longDFLT_STATS_PRINT_FREQDefault statistics print frequency in milliseconds (value is 0ms).static intDFLT_THREAD_PRIDefault value for thread priority (value is 10).static intDFLT_THROTTLE_RECONNECT_RESET_TIMEOUT_INTERVALstatic intDFLT_TOP_HISTORY_SIZEDefault size of topology snapshots history.protected DiscoverySpiDataExchangeexchangeData exchange.protected longgridStartTimeStart time of the very first grid node.protected org.apache.ignite.spi.discovery.tcp.TcpDiscoveryImplimplprotected CopyOnWriteArrayList<IgniteInClosure<Socket>>incomeConnLsnrsprotected TcpDiscoveryIpFinderipFinderIP finder.protected longipFinderCleanFreqThe 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.protected longjoinTimeoutJoin timeout, in milliseconds.protected StringlocAddrLocal address.protected InetAddresslocHostLocal host.protected org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNodelocNodeLocal node.protected Collection<InetSocketAddress>locNodeAddrsInternal and external addresses of local node.protected Map<String,Object>locNodeAttrsLocal node attributes.protected IgniteProductVersionlocNodeVerLocal node version.protected intlocPortLocal port which node uses.protected intlocPortRangeLocal port range.protected IgniteLoggerlogLogger.protected DiscoverySpiListenerlsnrGrid discovery listener.protected DiscoveryMetricsProvidermetricsProviderMetrics provider.protected longmetricsUpdateFreqMetrics update messages issuing frequency.protected longnetTimeoutNetwork timeout.protected DiscoverySpiNodeAuthenticatornodeAuthNode authenticator.protected CopyOnWriteArrayList<IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage>>sndMsgLsnrsprotected IgniteSpiContextspiCtxprotected booleansslEnableSSL enable/disable flag.protected SSLSocketFactorysslSockFactorySSL socket factory.protected SSLServerSocketFactorysslSrvSockFactorySSL server socket factory.protected org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatisticsstatsStatistics.protected longstatsPrintFreqStatistics print frequency.protected intthreadPriThread priority for all threads started by SPI.protected inttopHistSizeSize of topology snapshots history.- 
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapterignite, igniteInstanceName
 
- 
 - 
Constructor SummaryConstructors Constructor Description TcpDiscoverySpi()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddIncomeConnectionListener(IgniteInClosure<Socket> lsnr)FOR TEST ONLY!!!voidaddSendMessageListener(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr)FOR TEST ONLY!!!booleanallNodesSupport(org.apache.ignite.internal.IgniteFeatures feature)protected IgniteSpiExceptionauthenticationFailedError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage msg)voidbrakeConnection()FOR TEST PURPOSE ONLY!protected IgniteSpiExceptioncheckFailedError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage msg)voidclientReconnect()booleanclientReconnectSupported()intclientWorkerCount()FOR TEST ONLY!!!@Nullable SerializableconsistentId()Gets consistent ID.voiddisconnect()Tells discovery SPI to disconnect from topology.voiddumpDebugInfo()Dumps debug info using configured logger.protected IgniteSpiExceptionduplicateIdError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage msg)protected booleanensured(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg)voidfailNode(UUID nodeId, @Nullable String warning)Initiates failure of provided node.longgetAckTimeout()Gets message acknowledgement timeout.AddressResolvergetAddressResolver()Gets address resolver.longgetAvgMessageProcessingTime()Gets avg message processing time.longgetConnectionRecoveryTimeout()Gets timeout that defines how long server node would try to recovery connection.
 SeesetConnectionRecoveryTimeout(long)for details.UUIDgetCoordinator()Gets current coordinator.longgetCoordinatorSinceTimestamp()Gets time local node has been coordinator since.longgetEffectiveSocketTimeout(boolean srvrOperation)Gets effective or resulting socket timeout with considering failure detection timeoutlonggetGridStartTime()Gets start time of the very first node in the grid.TcpDiscoveryIpFindergetIpFinder()Gets IP finder for IP addresses sharing and storing.longgetIpFinderCleanFrequency()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.StringgetIpFinderFormatted()GetsTcpDiscoveryIpFinder(string representation).longgetJoinTimeout()Get join timeout, in milliseconds.StringgetLocalAddress()Gets local address that was set to SPI withsetLocalAddress(String)method.ClusterNodegetLocalNode()Gets local node.UUIDgetLocalNodeId()Gets ID of the local node.intgetLocalPort()Gets local TCP port SPI listens to.intgetLocalPortRange()Gets local TCP port range.longgetMaxAckTimeout()Gets maximum message acknowledgement timeout.longgetMaxMessageProcessingTime()Gets max message processing time.intgetMessageWorkerQueueSize()Gets message worker queue current size.longgetNetworkTimeout()Gets network timeout.@Nullable ClusterNodegetNode(UUID nodeId)Gets node by ID.ClusterNodegetNode0(UUID id)longgetNodesFailed()Gets failed nodes count.longgetNodesJoined()Gets joined nodes count.longgetNodesLeft()Gets left nodes count.longgetPendingMessagesDiscarded()Gets pending messages discarded count.longgetPendingMessagesRegistered()Gets pending messages registered count.Map<String,Integer>getProcessedMessages()Gets processed messages counts (grouped by type).Map<String,Integer>getReceivedMessages()Gets received messages counts (grouped by type).intgetReconnectCount()Gets number of connection attempts.longgetReconnectDelay()Gets the amount of time in milliseconds that node waits before retrying to (re)connect to the cluster.Collection<ClusterNode>getRemoteNodes()Gets collection of remote nodes in grid or empty collection if no remote nodes found.longgetSocketTimeout()Gets socket timeout.intgetSoLinger()Gets SO_LINGER timeout for socket.IgniteSpiContextgetSpiContext()Gets SPI context.StringgetSpiState()Gets current SPI state.longgetStatisticsPrintFrequency()Gets statistics print frequency.intgetThreadPriority()Gets thread priority.longgetTopHistorySize()intgetTotalProcessedMessages()Gets total processed messages count.intgetTotalReceivedMessages()Gets total received messages count.protected voidinitializeImpl()protected voidinitLocalNode(int srvPort, boolean addExtAddrAttr)Collection<Object>injectables()This method returns SPI internal instances that need to be injected as well.protected voidinjectResources(Ignite ignite)Inject resourcesbooleanisClientMode()Whether or not discovery is started in client mode.booleanisClientReconnectDisabled()Iftrueclient does not try to reconnect after server detected client node failure.booleanisForceServerMode()Deprecated.Will be removed at 3.0.booleanisLocalNodeCoordinator()Checks whether local node is coordinator.booleanknownNode(UUID nodeId)protected Marshallermarshaller()protected voidonContextDestroyed0()Method to be called in the beginning of onContextDestroyed() method.protected voidonContextInitialized0(IgniteSpiContext spiCtx)Method to be called in the end of onContextInitialized method.protected voidonExchange(org.apache.ignite.spi.discovery.tcp.internal.DiscoveryDataPacket dataPacket, ClassLoader clsLdr)protected SocketopenSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)protected SocketopenSocket(Socket sock, InetSocketAddress remAddr, IgniteSpiOperationTimeoutHelper timeoutHelper)Connects to remote address sendingU.IGNITE_HEADERwhen connection is established.booleanpingNode(UUID nodeId)Pings the remote node to see if it's alive.protected <T> TreadMessage(Socket sock, @Nullable InputStream in, long timeout)Reads message from the socket limiting read time.protected intreadReceipt(Socket sock, long timeout)Reads message delivery receipt from the socket.protected Collection<InetSocketAddress>registeredAddresses()Gets addresses registered in the IP finder, initializes addresses having no port (or 0 port) withDFLT_PORT.voidremoveIncomeConnectionListener(IgniteInClosure<Socket> lsnr)FOR TEST ONLY!!!voidremoveSendMessageListener(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr)FOR TEST ONLY!!!voidresolveCommunicationFailure(ClusterNode node, Exception err)protected Collection<InetSocketAddress>resolvedAddresses()Resolves addresses registered in the IP finder, removes duplicates and local host address and returns the collection of.voidsendCustomEvent(DiscoverySpiCustomMessage msg)Sends custom message across the ring.TcpDiscoverySpisetAckTimeout(long ackTimeout)Sets timeout for receiving acknowledgement for sent message.TcpDiscoverySpisetAddressFilter(IgnitePredicate<InetSocketAddress> addressFilter)Sets filter for IP addresses.voidsetAddressResolver(AddressResolver addrRslvr)Sets address resolver.voidsetAuthenticator(DiscoverySpiNodeAuthenticator auth)Sets discovery SPI node authenticator.voidsetClientReconnectDisabled(boolean clientReconnectDisabled)Sets client reconnect disabled flag.voidsetConnectionRecoveryTimeout(long connRecoveryTimeout)Sets timeout that defines how long server node would try to recovery connection.voidsetDataExchange(DiscoverySpiDataExchange exchange)Sets a handler for initial data exchange between Ignite nodes.TcpDiscoverySpisetForceServerMode(boolean forceSrvMode)Deprecated.Will be removed at 3.0.voidsetInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr)For TESTING only.TcpDiscoverySpisetIpFinder(TcpDiscoveryIpFinder ipFinder)Sets IP finder for IP addresses sharing and storing.TcpDiscoverySpisetIpFinderCleanFrequency(long ipFinderCleanFreq)Sets IP finder clean frequency in milliseconds.TcpDiscoverySpisetJoinTimeout(long joinTimeout)Sets join timeout.voidsetListener(@Nullable DiscoverySpiListener lsnr)Sets a listener for discovery events.TcpDiscoverySpisetLocalAddress(String locAddr)Sets network addresses for the Discovery SPI.TcpDiscoverySpisetLocalPort(int locPort)Sets local port to listen to.TcpDiscoverySpisetLocalPortRange(int locPortRange)Range for local ports.TcpDiscoverySpisetMaxAckTimeout(long maxAckTimeout)Sets maximum timeout for receiving acknowledgement for sent message.voidsetMetricsProvider(DiscoveryMetricsProvider metricsProvider)Sets discovery metrics provider.TcpDiscoverySpisetName(String name)Sets SPI name.TcpDiscoverySpisetNetworkTimeout(long netTimeout)Sets maximum network timeout to use for network operations.voidsetNodeAttributes(Map<String,Object> attrs, IgniteProductVersion ver)Sets node attributes and node version which will be distributed in grid during join process.TcpDiscoverySpisetReconnectCount(int reconCnt)Number of times node tries to (re)establish connection to another node.TcpDiscoverySpisetReconnectDelay(int reconDelay)Sets the amount of time in milliseconds that node waits before retrying to (re)connect to the cluster.TcpDiscoverySpisetSocketTimeout(long sockTimeout)Sets socket operations timeout.voidsetSoLinger(int soLinger)Sets SO_LINGER to use for all created sockets.TcpDiscoverySpisetStatisticsPrintFrequency(long statsPrintFreq)Sets statistics print frequency.TcpDiscoverySpisetThreadPriority(int threadPri)Sets thread priority.TcpDiscoverySpisetTopHistorySize(int topHistSize)Sets size of topology snapshots history.voidsimulateNodeFailure()FOR TEST ONLY!!!voidspiStart(@Nullable String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.protected voidstartMessageProcess(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg)booleansupportsCommunicationFailureResolve()StringtoString()voidwaitForClientMessagePrecessed()FOR TEST PURPOSE ONLY!protected voidwriteToSocket(Socket sock, OutputStream out, org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, long timeout)Writes message to the socket.protected voidwriteToSocket(Socket sock, org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, byte[] data, long timeout)Writes message to the socket.protected voidwriteToSocket(Socket sock, org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, long timeout)Writes message to the socket.protected voidwriteToSocket(ClusterNode node, Socket sock, OutputStream out, org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, long timeout)protected voidwriteToSocket(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout)Writes response to the socket.- 
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapteraddTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getName, getNodeAttributes, ignite, initFailureDetectionTimeout, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBean
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.ignite.spi.IgniteSpigetName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
 
- 
 
- 
- 
- 
Field Detail- 
ATTR_EXT_ADDRSpublic 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_RANGEpublic static final int DFLT_PORT_RANGE Default local port range (value is 100).- See Also:
- Constant Field Values
 
 - 
DFLT_PORTpublic static final int DFLT_PORT Default port to listen (value is 47500).- See Also:
- Constant Field Values
 
 - 
DFLT_JOIN_TIMEOUTpublic static final long DFLT_JOIN_TIMEOUT Default timeout for joining topology (value is 0).- See Also:
- Constant Field Values
 
 - 
DFLT_NETWORK_TIMEOUTpublic static final long DFLT_NETWORK_TIMEOUT Default network timeout in milliseconds (value is 5000ms).- See Also:
- Constant Field Values
 
 - 
DFLT_THREAD_PRIpublic static final int DFLT_THREAD_PRI Default value for thread priority (value is 10).- See Also:
- Constant Field Values
 
 - 
DFLT_TOP_HISTORY_SIZEpublic static final int DFLT_TOP_HISTORY_SIZE Default size of topology snapshots history.- See Also:
- Constant Field Values
 
 - 
DFLT_SOCK_TIMEOUTpublic static final long DFLT_SOCK_TIMEOUT Default socket operations timeout in milliseconds (value is 5000ms).- See Also:
- Constant Field Values
 
 - 
DFLT_ACK_TIMEOUTpublic 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_CLIENTpublic static final long DFLT_SOCK_TIMEOUT_CLIENT Default socket operations timeout in milliseconds (value is 5000ms).- See Also:
- Constant Field Values
 
 - 
DFLT_ACK_TIMEOUT_CLIENTpublic 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_CNTpublic static final int DFLT_RECONNECT_CNT Default reconnect attempts count (value is 10).- See Also:
- Constant Field Values
 
 - 
DFLT_RECONNECT_DELAYpublic 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_FREQpublic 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_FREQpublic static final long DFLT_STATS_PRINT_FREQ Default statistics print frequency in milliseconds (value is 0ms).- See Also:
- Constant Field Values
 
 - 
DFLT_MAX_ACK_TIMEOUTpublic 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_LINGERpublic 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_TIMEOUTpublic static final long DFLT_CONNECTION_RECOVERY_TIMEOUT Default connection recovery timeout in ms.
 - 
DFLT_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZEpublic static final int DFLT_DISCOVERY_CLIENT_RECONNECT_HISTORY_SIZE 
 - 
DFLT_NODE_IDS_HISTORY_SIZEpublic static final int DFLT_NODE_IDS_HISTORY_SIZE 
 - 
DFLT_DISCO_FAILED_CLIENT_RECONNECT_DELAYpublic static final int DFLT_DISCO_FAILED_CLIENT_RECONNECT_DELAY 
 - 
DFLT_THROTTLE_RECONNECT_RESET_TIMEOUT_INTERVALpublic static final int DFLT_THROTTLE_RECONNECT_RESET_TIMEOUT_INTERVAL 
 - 
DFLT_DISCOVERY_METRICS_QNT_WARNpublic static final int DFLT_DISCOVERY_METRICS_QNT_WARN 
 - 
locAddrprotected String locAddr Local address.
 - 
ipFinderprotected TcpDiscoveryIpFinder ipFinder IP finder.
 - 
netTimeoutprotected long netTimeout Network timeout.
 - 
joinTimeoutprotected 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.
 - 
threadPriprotected int threadPri Thread priority for all threads started by SPI.
 - 
metricsUpdateFreqprotected long metricsUpdateFreq Metrics update messages issuing frequency.
 - 
topHistSizeprotected int topHistSize Size of topology snapshots history.
 - 
connRecoveryTimeoutprotected long connRecoveryTimeout Default connection recovery timeout in ms.
 - 
lsnrprotected volatile DiscoverySpiListener lsnr Grid discovery listener.
 - 
exchangeprotected DiscoverySpiDataExchange exchange Data exchange.
 - 
metricsProviderprotected DiscoveryMetricsProvider metricsProvider Metrics provider.
 - 
locNodeVerprotected IgniteProductVersion locNodeVer Local node version.
 - 
locNodeprotected org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode locNode Local node.
 - 
cfgNodeIdprotected UUID cfgNodeId 
 - 
locHostprotected InetAddress locHost Local host.
 - 
locNodeAddrsprotected Collection<InetSocketAddress> locNodeAddrs Internal and external addresses of local node.
 - 
gridStartTimeprotected volatile long gridStartTime Start time of the very first grid node.
 - 
statsprotected final org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryStatistics stats Statistics.
 - 
locPortprotected int locPort Local port which node uses.
 - 
locPortRangeprotected int locPortRange Local port range.
 - 
statsPrintFreqprotected long statsPrintFreq Statistics print frequency.
 - 
ipFinderCleanFreqprotected 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
 
 - 
nodeAuthprotected DiscoverySpiNodeAuthenticator nodeAuth Node authenticator.
 - 
sslSrvSockFactoryprotected SSLServerSocketFactory sslSrvSockFactory SSL server socket factory.
 - 
sslSockFactoryprotected SSLSocketFactory sslSockFactory SSL socket factory.
 - 
sslEnableprotected boolean sslEnable SSL enable/disable flag.
 - 
sndMsgLsnrsprotected final CopyOnWriteArrayList<IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage>> sndMsgLsnrs 
 - 
incomeConnLsnrsprotected final CopyOnWriteArrayList<IgniteInClosure<Socket>> incomeConnLsnrs 
 - 
log@LoggerResource protected IgniteLogger log Logger.
 - 
implprotected org.apache.ignite.spi.discovery.tcp.TcpDiscoveryImpl impl 
 - 
spiCtxprotected IgniteSpiContext spiCtx 
 
- 
 - 
Method Detail- 
getSpiStatepublic String getSpiState() Gets current SPI state.- Returns:
- Current SPI state.
 
 - 
getMessageWorkerQueueSizepublic int getMessageWorkerQueueSize() Gets message worker queue current size.- Returns:
- Message worker queue current size.
 
 - 
getCoordinatorpublic UUID getCoordinator() Gets current coordinator.- Returns:
- Gets current coordinator.
 
 - 
getRemoteNodespublic Collection<ClusterNode> getRemoteNodes() Gets collection of remote nodes in grid or empty collection if no remote nodes found.- Specified by:
- getRemoteNodesin interface- DiscoverySpi
- Returns:
- Collection of remote nodes.
 
 - 
getNode@Nullable public @Nullable ClusterNode getNode(UUID nodeId) Gets node by ID.- Specified by:
- getNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node ID.
- Returns:
- Node with given ID or nullif node is not found.
 
 - 
getNode0public ClusterNode getNode0(UUID id) - Parameters:
- id- Id.
- Returns:
- Cluster node instance with specified ID.
 
 - 
pingNodepublic boolean pingNode(UUID nodeId) Pings the remote node to see if it's alive.- Specified by:
- pingNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node Id.
- Returns:
- trueif node alive,- falseotherwise.
 
 - 
disconnectpublic void disconnect() throws IgniteSpiExceptionTells discovery SPI to disconnect from topology. This is very close to callingIgniteSpi.spiStop()with accounting that it is not a full stop, but disconnect due to segmentation.- Specified by:
- disconnectin interface- DiscoverySpi
- Throws:
- IgniteSpiException- If any error occurs.
 
 - 
setAuthenticatorpublic void setAuthenticator(DiscoverySpiNodeAuthenticator auth) Sets discovery SPI node authenticator. This method is called before SPI start() method.- Specified by:
- setAuthenticatorin interface- DiscoverySpi
- Parameters:
- auth- Discovery SPI authenticator.
 
 - 
sendCustomEventpublic void sendCustomEvent(DiscoverySpiCustomMessage msg) throws IgniteException Sends custom message across the ring.- Specified by:
- sendCustomEventin interface- DiscoverySpi
- Parameters:
- msg- Custom message.
- Throws:
- IgniteException- if failed to sent the event message.
 
 - 
failNodepublic void failNode(UUID nodeId, @Nullable @Nullable String warning) Initiates failure of provided node.- Specified by:
- failNodein interface- DiscoverySpi
- Parameters:
- nodeId- Node ID.
- warning- Warning to be shown on all cluster nodes.
 
 - 
dumpDebugInfopublic void dumpDebugInfo() Dumps debug info using configured logger.
 - 
isClientModepublic boolean isClientMode() Whether or not discovery is started in client mode.- Specified by:
- isClientModein interface- DiscoverySpi
- Returns:
- trueif node is in client mode.
 
 - 
isForceServerMode@Deprecated public boolean isForceServerMode() Deprecated.Will be removed at 3.0.IftrueTcpDiscoverySpi will started in server mode regardless ofIgniteConfiguration.isClientMode()- Returns:
- forceServerMode flag.
 
 - 
setForceServerMode@IgniteSpiConfiguration(optional=true) @Deprecated public TcpDiscoverySpi setForceServerMode(boolean forceSrvMode) Deprecated.Will be removed at 3.0.Sets force server mode flag.If trueTcpDiscoverySpi is started in server mode regardless ofIgniteConfiguration.isClientMode().- Parameters:
- forceSrvMode- forceServerMode flag.
- Returns:
- thisfor chaining.
 
 - 
isClientReconnectDisabledpublic boolean isClientReconnectDisabled() Iftrueclient 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 trueclient does not try to reconnect after server detected client node failure.- Parameters:
- clientReconnectDisabled- Client reconnect disabled flag.
 
 - 
injectResources@IgniteInstanceResource protected void injectResources(Ignite ignite) Inject resources- Overrides:
- injectResourcesin class- IgniteSpiAdapter
- Parameters:
- ignite- Ignite.
 
 - 
setLocalAddress@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setLocalAddress(String locAddr) Sets network addresses for the Discovery SPI.If not provided, the value is resolved from IgniteConfiguration.getLocalHost(). If the latter is not set as well, the the node binds to all available IP addresses of an environment it's running on. If there is no a non-loopback address, thenInetAddress.getLocalHost()is used.NOTE: You should initialize the IgniteConfiguration.getLocalHost()orgetLocalAddress()parameter with the network interface that will be used for inter-node communication. Otherwise, the node can listen on multiple network addresses available in the environment and this can prolong node failures detection if some of the addresses are not reachable from other cluster nodes. For instance, if the node is bound to 3 network interfaces, it can take up to 'IgniteConfiguration.getFailureDetectionTimeout()* 3 +getConnectionRecoveryTimeout()' milliseconds for another node to detect a disconnect of the give node.- Parameters:
- locAddr- IP address.
- Returns:
- thisfor chaining.
 
 - 
getLocalAddresspublic String getLocalAddress() Gets local address that was set to SPI withsetLocalAddress(String)method.- Returns:
- local address.
 
 - 
setAddressResolver@IgniteSpiConfiguration(optional=true) public void setAddressResolver(AddressResolver addrRslvr) Sets address resolver.- Parameters:
- addrRslvr- Address resolver.
 
 - 
getAddressResolverpublic AddressResolver getAddressResolver() Gets address resolver.- Returns:
- Address resolver.
 
 - 
getReconnectCountpublic int getReconnectCount() Gets number of connection attempts.- Returns:
- Number of connection attempts.
 
 - 
setReconnectCount@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setReconnectCount(int reconCnt) Number of times node tries to (re)establish connection to another node.Note that SPI implementation will increase ackTimeoutby factor 2 on every retry.If not specified, default is DFLT_RECONNECT_CNT.When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout()is ignored.- Parameters:
- reconCnt- Number of retries during message sending.
- Returns:
- thisfor chaining.
- See Also:
- setAckTimeout(long)
 
 - 
getReconnectDelaypublic 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:
- thisfor chaining.
 
 - 
getMaxAckTimeoutpublic 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 maxAckTimeoutis 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:
- thisfor chaining.
 
 - 
getLocalPortpublic 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:
- thisfor chaining.
 
 - 
getLocalPortRangepublic 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 fromgetLocalPort()up untilgetLocalPort()+ locPortRange. If port range value is 0, then implementation will try bind only to the port provided bysetLocalPort(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:
- thisfor chaining.
 
 - 
getStatisticsPrintFrequencypublic 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:
- thisfor chaining.
 
 - 
getIpFinderCleanFrequencypublic 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_FREQAffected server nodes only. - Parameters:
- ipFinderCleanFreq- IP finder clean frequency.
- Returns:
- thisfor chaining.
 
 - 
getIpFinderpublic TcpDiscoveryIpFinder getIpFinder() Gets IP finder for IP addresses sharing and storing.- Returns:
- IP finder for IP addresses sharing and storing.
 
 - 
setIpFinder@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setIpFinder(TcpDiscoveryIpFinder ipFinder) Sets IP finder for IP addresses sharing and storing.If not provided TcpDiscoveryMulticastIpFinderwill be used by default.- Parameters:
- ipFinder- IP finder.
- Returns:
- thisfor chaining.
 
 - 
setAddressFilter@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setAddressFilter(IgnitePredicate<InetSocketAddress> addressFilter) Sets filter for IP addresses. Each address found byTcpDiscoveryIpFinderwill be checked against this filter and only passing addresses will be used for discovery.If not specified or null, all found addresses are used. - Parameters:
- addressFilter- Address filter to use
- Returns:
- thisfor chaining.
 
 - 
setSocketTimeout@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setSocketTimeout(long sockTimeout) Sets socket operations timeout. This timeout is used to limit connection time and write-to-socket time.Note that when running Ignite on Amazon EC2, socket timeout must be set to a value significantly greater than the default (e.g. to 30000).If not specified, default is DFLT_SOCK_TIMEOUTorDFLT_SOCK_TIMEOUT_CLIENT.When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout()is ignored.- Parameters:
- sockTimeout- Socket connection timeout.
- Returns:
- thisfor chaining.
 
 - 
setAckTimeout@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setAckTimeout(long ackTimeout) Sets 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. If not specified, default is DFLT_ACK_TIMEOUTorDFLT_ACK_TIMEOUT_CLIENT.When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout()is ignored.- Parameters:
- ackTimeout- Acknowledgement timeout.
- Returns:
- thisfor chaining.
 
 - 
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.
 
 - 
setNetworkTimeout@IgniteSpiConfiguration(optional=true) public TcpDiscoverySpi setNetworkTimeout(long netTimeout) Sets maximum network timeout to use for network operations.If not specified, default is DFLT_NETWORK_TIMEOUT.- Parameters:
- netTimeout- Network timeout.
- Returns:
- thisfor chaining.
 
 - 
getJoinTimeoutpublic 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 (- 0means wait forever).
- Returns:
- thisfor 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:
- thisfor chaining.
 
 - 
getTopHistorySizepublic 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 sizeDFLT_TOP_HISTORY_SIZE.- Parameters:
- topHistSize- Size of topology snapshots history.
- Returns:
- thisfor chaining.
 
 - 
getConnectionRecoveryTimeoutpublic long getConnectionRecoveryTimeout() Gets timeout that defines how long server node would try to recovery connection.
 SeesetConnectionRecoveryTimeout(long)for details.- Returns:
- Timeout that defines how long server node would try to recovery connection.
 
 - 
setConnectionRecoveryTimeoutpublic 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.- 0means node will not recheck failed nodes.
 
 - 
setNodeAttributespublic 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:
- setNodeAttributesin interface- DiscoverySpi
- Parameters:
- attrs- Map of node attributes.
- ver- Product version.
 
 - 
getLocalNodeIdpublic UUID getLocalNodeId() Gets ID of the local node.- Returns:
- ID of the local node.
 
 - 
consistentId@Nullable public @Nullable Serializable consistentId() throws IgniteSpiException Gets consistent ID.- Specified by:
- consistentIdin interface- DiscoverySpi
- Returns:
- Consistent ID of this Ignite instance or nullif not applicable.
- Throws:
- IgniteSpiException- If failed.
 
 - 
initLocalNodeprotected void initLocalNode(int srvPort, boolean addExtAddrAttr)- Parameters:
- srvPort- Server port.
- addExtAddrAttr- If- trueadds- ATTR_EXT_ADDRSattribute.
 
 - 
injectablespublic 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:
- injectablesin class- IgniteSpiAdapter
- Returns:
- Internal SPI objects that also need to be injected.
 
 - 
getSocketTimeoutpublic long getSocketTimeout() Gets socket timeout.- Returns:
- Socket timeout.
 
 - 
getEffectiveSocketTimeoutpublic long getEffectiveSocketTimeout(boolean srvrOperation) Gets effective or resulting socket timeout with considering failure detection timeout- Parameters:
- srvrOperation-- Trueif socket connect to server node,- Falseif socket connect to client node.
- Returns:
- Resulting socket timeout.
 
 - 
getAckTimeoutpublic long getAckTimeout() Gets message acknowledgement timeout.- Returns:
- Message acknowledgement timeout.
 
 - 
getSoLingerpublic int getSoLinger() Gets SO_LINGER timeout for socket.- Returns:
- SO_LINGER timeout for socket.
 
 - 
getNetworkTimeoutpublic long getNetworkTimeout() Gets network timeout.- Returns:
- Network timeout.
 
 - 
getThreadPrioritypublic int getThreadPriority() Gets thread priority. All threads within SPI will be started with it.- Returns:
- Thread priority.
 
 - 
getIpFinderFormattedpublic String getIpFinderFormatted() GetsTcpDiscoveryIpFinder(string representation).- Returns:
- IPFinder (string representation).
 
 - 
getNodesJoinedpublic long getNodesJoined() Gets joined nodes count.- Returns:
- Nodes joined count.
 
 - 
getNodesLeftpublic long getNodesLeft() Gets left nodes count.- Returns:
- Left nodes count.
 
 - 
getNodesFailedpublic long getNodesFailed() Gets failed nodes count.- Returns:
- Failed nodes count.
 
 - 
getPendingMessagesRegisteredpublic long getPendingMessagesRegistered() Gets pending messages registered count.- Returns:
- Pending messages registered count.
 
 - 
getPendingMessagesDiscardedpublic long getPendingMessagesDiscarded() Gets pending messages discarded count.- Returns:
- Pending messages registered count.
 
 - 
getAvgMessageProcessingTimepublic long getAvgMessageProcessingTime() Gets avg message processing time.- Returns:
- Avg message processing time.
 
 - 
getMaxMessageProcessingTimepublic long getMaxMessageProcessingTime() Gets max message processing time.- Returns:
- Max message processing time.
 
 - 
getTotalReceivedMessagespublic int getTotalReceivedMessages() Gets total received messages count.- Returns:
- Total received messages count.
 
 - 
getReceivedMessagespublic Map<String,Integer> getReceivedMessages() Gets received messages counts (grouped by type).- Returns:
- Map containing message types and respective counts.
 
 - 
getTotalProcessedMessagespublic int getTotalProcessedMessages() Gets total processed messages count.- Returns:
- Total processed messages count.
 
 - 
getProcessedMessagespublic Map<String,Integer> getProcessedMessages() Gets processed messages counts (grouped by type).- Returns:
- Map containing message types and respective counts.
 
 - 
getCoordinatorSinceTimestamppublic long getCoordinatorSinceTimestamp() Gets time local node has been coordinator since.- Returns:
- Time local node is coordinator since.
 
 - 
onContextInitialized0protected void onContextInitialized0(IgniteSpiContext spiCtx) throws IgniteSpiException Method to be called in the end of onContextInitialized method.- Overrides:
- onContextInitialized0in class- IgniteSpiAdapter
- Parameters:
- spiCtx- SPI context.
- Throws:
- IgniteSpiException- In case of errors.
 
 - 
onContextDestroyed0protected void onContextDestroyed0() Method to be called in the beginning of onContextDestroyed() method.- Overrides:
- onContextDestroyed0in class- IgniteSpiAdapter
 
 - 
getSpiContextpublic IgniteSpiContext getSpiContext() Gets SPI context.- Overrides:
- getSpiContextin class- IgniteSpiAdapter
- Returns:
- SPI context.
 
 - 
getLocalNodepublic ClusterNode getLocalNode() Gets local node.- Specified by:
- getLocalNodein interface- DiscoverySpi
- Overrides:
- getLocalNodein class- IgniteSpiAdapter
- Returns:
- Local node.
 
 - 
setListenerpublic void setListener(@Nullable @Nullable DiscoverySpiListener lsnr)Sets a listener for discovery events. Refer toDiscoveryEventfor a set of all possible discovery events.TODO: This method should be removed from public API in Apache Ignite 3.0 - Specified by:
- setListenerin interface- DiscoverySpi
- Parameters:
- lsnr- Listener to discovery events or- nullto unset the listener.
 
 - 
setDataExchangepublic void setDataExchange(DiscoverySpiDataExchange exchange) Sets a handler for initial data exchange between Ignite nodes.- Specified by:
- setDataExchangein interface- DiscoverySpi
- Parameters:
- exchange- Discovery data exchange handler.
 
 - 
setMetricsProviderpublic void setMetricsProvider(DiscoveryMetricsProvider metricsProvider) Sets discovery metrics provider. Use metrics provided byDiscoveryMetricsProvider.metrics()method to exchange dynamic metrics between nodes.- Specified by:
- setMetricsProviderin interface- DiscoverySpi
- Parameters:
- metricsProvider- Provider of metrics data.
 
 - 
getGridStartTimepublic 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:
- getGridStartTimein interface- DiscoverySpi
- Returns:
- Start time of the first node in grid or 0if SPI implementation does not support this method.
 
 - 
openSocketprotected Socket openSocket(InetSocketAddress sockAddr, IgniteSpiOperationTimeoutHelper timeoutHelper) throws IOException, IgniteSpiOperationTimeoutException - Parameters:
- sockAddr- Remote address.
- timeoutHelper- Timeout helper.
- Returns:
- Opened socket.
- Throws:
- IOException- If failed.
- IgniteSpiOperationTimeoutException- In case of timeout.
 
 - 
openSocketprotected Socket openSocket(Socket sock, InetSocketAddress remAddr, IgniteSpiOperationTimeoutHelper timeoutHelper) throws IOException, IgniteSpiOperationTimeoutException Connects to remote address sendingU.IGNITE_HEADERwhen connection is established.- Parameters:
- sock- Socket bound to a local host address.
- remAddr- Remote address.
- timeoutHelper- Timeout helper.
- Returns:
- Connected socket.
- Throws:
- IOException- If failed.
- IgniteSpiOperationTimeoutException- In case of timeout.
 
 - 
writeToSocketprotected 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.
 
 - 
writeToSocketprotected 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.
 
 - 
writeToSocketprotected void writeToSocket(ClusterNode node, Socket sock, OutputStream out, org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, long timeout) throws IOException, IgniteCheckedException - Parameters:
- node- Target node.
- sock- Socket.
- out- Stream to write to.
- msg- Message.
- timeout- Timeout.
- Throws:
- IOException- If IO failed or write timed out.
- IgniteCheckedException- If marshalling failed.
 
 - 
writeToSocketprotected 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.
 
 - 
writeToSocketprotected void writeToSocket(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout) throws IOExceptionWrites 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.
 
 - 
readMessageprotected <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.
 
 - 
readReceiptprotected 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.
 
 - 
resolvedAddressesprotected 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.
 
 - 
registeredAddressesprotected Collection<InetSocketAddress> registeredAddresses() throws IgniteSpiException Gets addresses registered in the IP finder, initializes addresses having no port (or 0 port) withDFLT_PORT.- Returns:
- Registered addresses.
- Throws:
- IgniteSpiException- If an error occurs.
 
 - 
duplicateIdErrorprotected IgniteSpiException duplicateIdError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage msg) - Parameters:
- msg- Message.
- Returns:
- Error.
 
 - 
authenticationFailedErrorprotected IgniteSpiException authenticationFailedError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage msg) - Parameters:
- msg- Message.
- Returns:
- Error.
 
 - 
checkFailedErrorprotected IgniteSpiException checkFailedError(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage msg) - Parameters:
- msg- Message.
- Returns:
- Error.
 
 - 
ensuredprotected boolean ensured(org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage msg) - Parameters:
- msg- Message.
- Returns:
- Whether delivery of the message is ensured.
 
 - 
onExchangeprotected 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.
 
 - 
spiStartpublic void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiExceptionThis method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
- spiStartin interface- IgniteSpi
- Parameters:
- igniteInstanceName- Name of Ignite instance this SPI is being started for (- nullfor default Ignite instance).
- Throws:
- IgniteSpiException- Throws in case of any error during SPI start.
 
 - 
initializeImplprotected void initializeImpl() 
 - 
spiStoppublic void spiStop() throws IgniteSpiExceptionThis 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:
- spiStopin interface- IgniteSpi
- Throws:
- IgniteSpiException- Thrown in case of any error during SPI stop.
 
 - 
clientReconnectpublic void clientReconnect() throws IgniteSpiException- Specified by:
- clientReconnectin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Throws:
- IgniteSpiException
 
 - 
allNodesSupportpublic boolean allNodesSupport(org.apache.ignite.internal.IgniteFeatures feature) - Specified by:
- allNodesSupportin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- feature- Feature to check.
- Returns:
- trueif all nodes support the given feature.
 
 - 
knownNodepublic boolean knownNode(UUID nodeId) - Specified by:
- knownNodein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- nodeId- Node ID.
- Returns:
- Trueif node joining or already joined topology.
 
 - 
clientReconnectSupportedpublic boolean clientReconnectSupported() - Specified by:
- clientReconnectSupportedin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Returns:
- Trueif SPI supports client reconnect.
 
 - 
supportsCommunicationFailureResolvepublic boolean supportsCommunicationFailureResolve() - Specified by:
- supportsCommunicationFailureResolvein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Returns:
- Trueif supports communication error resolve.
 
 - 
resolveCommunicationFailurepublic void resolveCommunicationFailure(ClusterNode node, Exception err) - Specified by:
- resolveCommunicationFailurein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- node- Problem node.
- err- Connection error.
 
 - 
clientWorkerCountpublic int clientWorkerCount() FOR TEST ONLY!!!- Returns:
- Client workers count.
 
 - 
addSendMessageListenerpublic void addSendMessageListener(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr) FOR TEST ONLY!!!- Parameters:
- lsnr- Listener of sent messages.
 
 - 
setInternalListenerpublic void setInternalListener(org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpiInternalListener lsnr) For TESTING only.- Specified by:
- setInternalListenerin interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
- Parameters:
- lsnr- Listener.
 
 - 
removeSendMessageListenerpublic void removeSendMessageListener(IgniteInClosure<org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage> lsnr) FOR TEST ONLY!!!- Parameters:
- lsnr- Instance of the listener for sent messages.
 
 - 
addIncomeConnectionListenerpublic void addIncomeConnectionListener(IgniteInClosure<Socket> lsnr) FOR TEST ONLY!!!- Parameters:
- lsnr- Instance of the listener for incoming messages.
 
 - 
removeIncomeConnectionListenerpublic void removeIncomeConnectionListener(IgniteInClosure<Socket> lsnr) FOR TEST ONLY!!!- Parameters:
- lsnr- Instance of the listener for incoming messages.
 
 - 
waitForClientMessagePrecessedpublic void waitForClientMessagePrecessed() FOR TEST PURPOSE ONLY!
 - 
simulateNodeFailurepublic 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:
- simulateNodeFailurein interface- org.apache.ignite.internal.managers.discovery.IgniteDiscoverySpi
 
 - 
brakeConnectionpublic void brakeConnection() FOR TEST PURPOSE ONLY!
 - 
isLocalNodeCoordinatorpublic boolean isLocalNodeCoordinator() Checks whether local node is coordinator. Nodes that are leaving or failed (but are still in topology) are removed from search.- Returns:
- trueif local node is coordinator.
 
 - 
marshallerprotected Marshaller marshaller() - Returns:
- Marshaller.
 
 - 
setNamepublic TcpDiscoverySpi setName(String name) Sets SPI name.- Overrides:
- setNamein class- IgniteSpiAdapter
- Parameters:
- name- SPI name.
- Returns:
- thisfor chaining.
 
 
- 
 
-