Class TcpCommunicationSpi
- java.lang.Object
- 
- org.apache.ignite.spi.IgniteSpiAdapter
- 
- org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializer
- 
- org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
 
 
 
- 
- All Implemented Interfaces:
- CommunicationSpi<Message>,- IgniteSpi
 
 @IgniteSpiMultipleInstancesSupport(true) @IgniteSpiConsistencyChecked(optional=false) public class TcpCommunicationSpi extends org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializer TcpCommunicationSpi is default communication SPI which uses TCP/IP protocol and Java NIO to communicate with other nodes.To enable communication with other nodes, this SPI adds ATTR_ADDRSandATTR_PORTlocal node attributes (seeClusterNode.attributes().At startup, this SPI tries to start listening to local port specified by TcpCommunicationConfigInitializer.setLocalPort(int)method. If local port is occupied, then SPI will automatically increment the port number until it can successfully bind for listening.TcpCommunicationConfigInitializer.setLocalPortRange(int)configuration parameter controls maximum number of ports that SPI will try before it fails. Port range comes very handy when starting multiple grid nodes on the same machine or even in the same VM. In this case all nodes can be brought up without a single change in configuration.This SPI caches connections to remote nodes so it does not have to reconnect every time a message is sent. By default, idle connections are kept active for DFLT_IDLE_CONN_TIMEOUTperiod and then are closed. UseTcpCommunicationConfigInitializer.setIdleConnectionTimeout(long)configuration parameter to configure you own idle connection timeout.Failure DetectionConfiguration defaults (see Configuration section below andIgniteConfiguration.getFailureDetectionTimeout()) for details) are chosen to make possible for communication 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:TcpCommunicationConfigInitializer.getConnectTimeout(),TcpCommunicationConfigInitializer.getMaxConnectTimeout(),TcpCommunicationConfigInitializer.getReconnectCount(). If any of those parameters is set explicitly, then the failure timeout setting will be ignored.If it's required to perform advanced settings of failure detection and IgniteConfiguration.getFailureDetectionTimeout()is unsuitable then variousTcpCommunicationSpiconfiguration parameters may be used.ConfigurationMandatoryThis SPI has no mandatory configuration parameters.OptionalThe following configuration parameters are optional:- Address resolver (see TcpCommunicationConfigInitializer.setAddressResolver(AddressResolver)
- Node local IP address (see TcpCommunicationConfigInitializer.setLocalAddress(String))
- Node local port number (see TcpCommunicationConfigInitializer.setLocalPort(int))
- Local port range (see TcpCommunicationConfigInitializer.setLocalPortRange(int)
- Use paired connections (see TcpCommunicationConfigInitializer.setUsePairedConnections(boolean)
- Connections per node (see TcpCommunicationConfigInitializer.setConnectionsPerNode(int))
- Idle connection timeout (see TcpCommunicationConfigInitializer.setIdleConnectionTimeout(long))
- Direct or heap buffer allocation (see TcpCommunicationConfigInitializer.setDirectBuffer(boolean))
- Direct or heap buffer allocation for sending (see TcpCommunicationConfigInitializer.setDirectSendBuffer(boolean))
- Count of selectors and selector threads for NIO server (see TcpCommunicationConfigInitializer.setSelectorsCount(int))
- Selector thread busy-loop iterations (see TcpCommunicationConfigInitializer.setSelectorSpins(long)
- TCP_NODELAYsocket option for sockets (see- TcpCommunicationConfigInitializer.setTcpNoDelay(boolean))
- Filter reachable addresses (see TcpCommunicationConfigInitializer.setFilterReachableAddresses(boolean)
- Message queue limit (see TcpCommunicationConfigInitializer.setMessageQueueLimit(int))
- Slow client queue limit (see TcpCommunicationConfigInitializer.setSlowClientQueueLimit(int))
- Connect timeout (see TcpCommunicationConfigInitializer.setConnectTimeout(long))
- Maximum connect timeout (see TcpCommunicationConfigInitializer.setMaxConnectTimeout(long))
- Reconnect attempts count (see TcpCommunicationConfigInitializer.setReconnectCount(int))
- Socket receive buffer size (see TcpCommunicationConfigInitializer.setSocketReceiveBuffer(int))
- Socket send buffer size (see TcpCommunicationConfigInitializer.setSocketSendBuffer(int))
- Socket write timeout (see TcpCommunicationConfigInitializer.setSocketWriteTimeout(long))
- Number of received messages after which acknowledgment is sent (see TcpCommunicationConfigInitializer.setAckSendThreshold(int))
- Maximum number of unacknowledged messages (see TcpCommunicationConfigInitializer.setUnacknowledgedMessagesBufferSize(int))
 Java ExampleTcpCommunicationSpi is used by default and should be explicitly configured only if some SPI configuration parameters need to be overridden.TcpCommunicationSpi commSpi = new TcpCommunicationSpi(); // Override local port. commSpi.setLocalPort(4321); IgniteConfiguration cfg = new IgniteConfiguration(); // Override default communication SPI. cfg.setCommunicationSpi(commSpi); // Start grid. Ignition.start(cfg); Spring ExampleTcpCommunicationSpi can be configured from Spring XML configuration file:<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <property name="communicationSpi"> <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"> <!-- Override local port. --> <property name="localPort" value="4321"/> </bean> </property> ... </bean>  
 For information about Spring framework visit www.springframework.org- See Also:
- CommunicationSpi
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringATTR_ADDRSNode attribute that is mapped to node IP addresses (value is comm.tcp.addrs).static StringATTR_EXT_ADDRSNode attribute that is mapped to node's external addresses (value is comm.tcp.ext-addrs).static StringATTR_FORCE_CLIENT_SERVER_CONNECTIONSstatic StringATTR_HOST_NAMESNode attribute that is mapped to node host names (value is comm.tcp.host.names).static StringATTR_PAIRED_CONNAttr paired connection.static StringATTR_PORTNode attribute that is mapped to node port number (value is comm.tcp.port).static StringATTR_SHMEM_PORTDeprecated.This constant is not used and will be removed in future releases.static StringCOMMUNICATION_METRICS_GROUP_NAMECommunication metrics group name.static intCONN_IDX_METAConnection index meta for session.static intCONSISTENT_ID_METANode consistent id meta for session.static intDFLT_ACK_SND_THRESHOLDDefault received messages threshold for sending ack.static intDFLT_CONN_PER_NODEDefault connections per node.static longDFLT_CONN_TIMEOUTDefault connection timeout (value is 5000ms).static booleanDFLT_FILTER_REACHABLE_ADDRESSESDefault value forFILTER_REACHABLE_ADDRESSESsocket option (value is false).static longDFLT_IDLE_CONN_TIMEOUTDefault idle connection timeout (value is 10min).static longDFLT_MAX_CONN_TIMEOUTDefault Maximum connection timeout (value is 600,000ms).static intDFLT_MSG_QUEUE_LIMITDefault message queue limit per connection (for incoming and outgoing .static intDFLT_PORTDefault port which node sets listener to (value is 47100).static intDFLT_PORT_RANGEDefault local port range (value is 100).static intDFLT_RECONNECT_CNTDefault reconnect attempts count (value is 10).static intDFLT_SELECTORS_CNTDefault count of selectors for TCP server equals to"Math.max(4, Runtime.getRuntime().availableProcessors() / 2)".static intDFLT_SHMEM_PORTDeprecated.This constant is not used and will be removed in future releases.static intDFLT_SOCK_BUF_SIZEDefault socket send and receive buffer size.static longDFLT_SOCK_WRITE_TIMEOUTDefault socket write timeout.static booleanDFLT_TCP_NODELAYDefault value forTCP_NODELAYsocket option (value is true).static IntegerDISABLED_CLIENT_PORTClient nodes might have port0if they have no server socket opened.static shortHANDSHAKE_MSG_TYPEHandshake message type.static shortHANDSHAKE_WAIT_MSG_TYPEHandshake wait message type.static shortNODE_ID_MSG_TYPENode ID message type.static StringOUT_OF_RESOURCES_TCP_MSGDeprecated.This constant is not used and will be removed in future releases.static StringRECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESCReceived messages by node consistent id metric description.static StringRECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAMEReceived messages by node consistent id metric name.static StringRECEIVED_MESSAGES_BY_TYPE_METRIC_DESCReceived messages by type metric description.static StringRECEIVED_MESSAGES_BY_TYPE_METRIC_NAMEReceived messages by type metric name.static StringRECEIVED_MESSAGES_METRIC_DESCReceived messages metric description.static StringRECEIVED_MESSAGES_METRIC_NAMEReceived messages metric name.static shortRECOVERY_LAST_ID_MSG_TYPERecovery last received ID message type.static StringSENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESCSent messages by node consistent id metric description.static StringSENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAMESent messages by node consistent id metric name.static StringSENT_MESSAGES_BY_TYPE_METRIC_DESCSent messages by type metric description.static StringSENT_MESSAGES_BY_TYPE_METRIC_NAMESent messages by type metric name.static StringSENT_MESSAGES_METRIC_DESCSent messages metric description.static StringSENT_MESSAGES_METRIC_NAMESent messages metric name.- 
Fields inherited from class org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializerattributeNames, cfg, connPlc, metricsLsnr, tracing
 - 
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapterignite, igniteInstanceName
 
- 
 - 
Constructor SummaryConstructors Constructor Description TcpCommunicationSpi()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcheckConfigurationConsistency0(IgniteSpiContext spiCtx, ClusterNode node, boolean starting)Method which is called in the end of checkConfigurationConsistency() method.IgniteFuture<BitSet>checkConnection(List<ClusterNode> nodes)protected org.apache.ignite.internal.util.nio.GridCommunicationClientcreateTcpClient(ClusterNode node, int connIdx)Establish TCP connection to remote node and returns client.org.apache.ignite.internal.IgniteInternalFuture<String>dumpNodeStatistics(UUID nodeId)voiddumpStats()Dumps SPI per-connection stats to logs.CommunicationListenergetListener()intgetOutboundMessagesQueueSize()Gets outbound messages queue size.longgetReceivedBytesCount()Gets received bytes count.Map<UUID,Long>getReceivedMessagesByNode()Gets received messages counts (grouped by node).Map<String,Long>getReceivedMessagesByType()Gets received messages counts (grouped by type).intgetReceivedMessagesCount()Gets received messages count.longgetSentBytesCount()Gets sent bytes count.Map<UUID,Long>getSentMessagesByNode()Gets sent messages counts (grouped by node).Map<String,Long>getSentMessagesByType()Gets sent messages counts (grouped by type).intgetSentMessagesCount()Gets sent messages count.IgniteSpiContextgetSpiContext()Gets SPI context.static shortmakeMessageType(byte b0, byte b1)Concatenates the two parameter bytes to form a message type value.Collection<InetSocketAddress>nodeAddresses(ClusterNode node, boolean filterReachableAddrs)protected voidnotifyListener(UUID sndId, Message msg, IgniteRunnable msgC)voidonClientDisconnected(IgniteFuture<?> reconnectFut)Client node disconnected callback.voidonClientReconnected(boolean clusterRestarted)Client node reconnected callback.protected voidonContextDestroyed0()Method to be called in the beginning of onContextDestroyed() method.voidonContextInitialized0(IgniteSpiContext spiCtx)Method to be called in the end of onContextInitialized method.org.apache.ignite.internal.IgniteInternalFuture<Channel>openChannel(ClusterNode remote, Message initMsg)protected voidprocessSessionCreationError(ClusterNode node, Collection<InetSocketAddress> addrs, IgniteCheckedException errs)Process errors if TCP/IPGridNioSessioncreation to remote node hasn't been performed.voidresetMetrics()Resets metrics for this SPI instance.voidsendMessage(ClusterNode node, Message msg)Sends given message to destination node.voidsendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)Sends given message to destination node.voidsetListener(CommunicationListener<Message> lsnr)Deprecated.voidsimulateNodeFailure()Deprecated.you should you DI and get instances of [nioSrvWrapper, commWorker, clientPool] via it.voidspiStart(String igniteInstanceName)This method is called to start SPI.voidspiStop()This method is called to stop SPI.StringtoString()static voidwriteMessageType(ByteBuffer buf, short type)Write message type to byte buffer.- 
Methods inherited from class org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConfigInitializerboundPort, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, forceClientToServerConnections, getAckSendThreshold, getAddressResolver, getConnectionsPerNode, getConnectTimeout, getIdleConnectionTimeout, getLocalAddress, getLocalPort, getLocalPortRange, getMaxConnectTimeout, getMessageQueueLimit, getNodeAttributes, getReconnectCount, getSelectorsCount, getSelectorSpins, getSharedMemoryPort, getSlowClientQueueLimit, getSocketReceiveBuffer, getSocketSendBuffer, getSocketWriteTimeout, getUnacknowledgedMessagesBufferSize, injectResources, isDirectBuffer, isDirectSendBuffer, isFilterReachableAddresses, isTcpNoDelay, isUsePairedConnections, setAckSendThreshold, setAddressResolver, setConnectionRequestor, setConnectionsPerNode, setConnectTimeout, setDirectBuffer, setDirectSendBuffer, setFilterReachableAddresses, setForceClientToServerConnections, setIdleConnectionTimeout, setLocalAddress, setLocalPort, setLocalPortRange, setMaxConnectTimeout, setMessageQueueLimit, setName, setReconnectCount, setSelectorsCount, setSelectorSpins, setSharedMemoryPort, setSlowClientQueueLimit, setSocketReceiveBuffer, setSocketSendBuffer, setSocketWriteTimeout, setTcpNoDelay, setUnacknowledgedMessagesBufferSize, setUsePairedConnections
 - 
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapteraddTimeoutObject, assertParameter, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, ignite, initFailureDetectionTimeout, injectables, isNodeStopping, onBeforeStart, 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, onContextDestroyed, onContextInitialized
 
- 
 
- 
- 
- 
Field Detail- 
OUT_OF_RESOURCES_TCP_MSG@Deprecated public static final String OUT_OF_RESOURCES_TCP_MSG Deprecated.This constant is not used and will be removed in future releases.- See Also:
- Constant Field Values
 
 - 
ATTR_ADDRSpublic static final String ATTR_ADDRS Node attribute that is mapped to node IP addresses (value is comm.tcp.addrs).- See Also:
- Constant Field Values
 
 - 
ATTR_HOST_NAMESpublic static final String ATTR_HOST_NAMES Node attribute that is mapped to node host names (value is comm.tcp.host.names).- See Also:
- Constant Field Values
 
 - 
ATTR_PORTpublic static final String ATTR_PORT Node attribute that is mapped to node port number (value is comm.tcp.port).- See Also:
- Constant Field Values
 
 - 
ATTR_SHMEM_PORT@Deprecated public static final String ATTR_SHMEM_PORT Deprecated.This constant is not used and will be removed in future releases.- See Also:
- Constant Field Values
 
 - 
ATTR_EXT_ADDRSpublic static final String ATTR_EXT_ADDRS Node attribute that is mapped to node's external addresses (value is comm.tcp.ext-addrs).- See Also:
- Constant Field Values
 
 - 
ATTR_PAIRED_CONNpublic static final String ATTR_PAIRED_CONN Attr paired connection.- See Also:
- Constant Field Values
 
 - 
DFLT_PORTpublic static final int DFLT_PORT Default port which node sets listener to (value is 47100).- See Also:
- Constant Field Values
 
 - 
DFLT_SHMEM_PORT@Deprecated public static final int DFLT_SHMEM_PORT Deprecated.This constant is not used and will be removed in future releases.- See Also:
- Constant Field Values
 
 - 
DFLT_IDLE_CONN_TIMEOUTpublic static final long DFLT_IDLE_CONN_TIMEOUT Default idle connection timeout (value is 10min).- See Also:
- Constant Field Values
 
 - 
DFLT_SOCK_BUF_SIZEpublic static final int DFLT_SOCK_BUF_SIZE Default socket send and receive buffer size.- See Also:
- Constant Field Values
 
 - 
DFLT_CONN_TIMEOUTpublic static final long DFLT_CONN_TIMEOUT Default connection timeout (value is 5000ms).- See Also:
- Constant Field Values
 
 - 
DFLT_MAX_CONN_TIMEOUTpublic static final long DFLT_MAX_CONN_TIMEOUT Default Maximum connection timeout (value is 600,000ms).- 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_MSG_QUEUE_LIMITpublic static final int DFLT_MSG_QUEUE_LIMIT Default message queue limit per connection (for incoming and outgoing .- See Also:
- Constant Field Values
 
 - 
DFLT_SELECTORS_CNTpublic static final int DFLT_SELECTORS_CNT Default count of selectors for TCP server equals to"Math.max(4, Runtime.getRuntime().availableProcessors() / 2)".
 - 
CONN_IDX_METApublic static final int CONN_IDX_META Connection index meta for session.
 - 
CONSISTENT_ID_METApublic static final int CONSISTENT_ID_META Node consistent id meta for session.
 - 
DFLT_PORT_RANGEpublic static final int DFLT_PORT_RANGE Default local port range (value is 100). SeeTcpCommunicationConfigInitializer.setLocalPortRange(int)for details.- See Also:
- Constant Field Values
 
 - 
DFLT_TCP_NODELAYpublic static final boolean DFLT_TCP_NODELAY Default value forTCP_NODELAYsocket option (value is true).- See Also:
- Constant Field Values
 
 - 
DFLT_FILTER_REACHABLE_ADDRESSESpublic static final boolean DFLT_FILTER_REACHABLE_ADDRESSES Default value forFILTER_REACHABLE_ADDRESSESsocket option (value is false).- See Also:
- Constant Field Values
 
 - 
DFLT_ACK_SND_THRESHOLDpublic static final int DFLT_ACK_SND_THRESHOLD Default received messages threshold for sending ack.- See Also:
- Constant Field Values
 
 - 
DFLT_SOCK_WRITE_TIMEOUTpublic static final long DFLT_SOCK_WRITE_TIMEOUT Default socket write timeout.- See Also:
- Constant Field Values
 
 - 
DFLT_CONN_PER_NODEpublic static final int DFLT_CONN_PER_NODE Default connections per node.- See Also:
- Constant Field Values
 
 - 
NODE_ID_MSG_TYPEpublic static final short NODE_ID_MSG_TYPE Node ID message type.- See Also:
- Constant Field Values
 
 - 
RECOVERY_LAST_ID_MSG_TYPEpublic static final short RECOVERY_LAST_ID_MSG_TYPE Recovery last received ID message type.- See Also:
- Constant Field Values
 
 - 
HANDSHAKE_MSG_TYPEpublic static final short HANDSHAKE_MSG_TYPE Handshake message type.- See Also:
- Constant Field Values
 
 - 
HANDSHAKE_WAIT_MSG_TYPEpublic static final short HANDSHAKE_WAIT_MSG_TYPE Handshake wait message type.- See Also:
- Constant Field Values
 
 - 
COMMUNICATION_METRICS_GROUP_NAMEpublic static final String COMMUNICATION_METRICS_GROUP_NAME Communication metrics group name.
 - 
SENT_MESSAGES_METRIC_NAMEpublic static final String SENT_MESSAGES_METRIC_NAME Sent messages metric name.- See Also:
- Constant Field Values
 
 - 
SENT_MESSAGES_METRIC_DESCpublic static final String SENT_MESSAGES_METRIC_DESC Sent messages metric description.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_METRIC_NAMEpublic static final String RECEIVED_MESSAGES_METRIC_NAME Received messages metric name.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_METRIC_DESCpublic static final String RECEIVED_MESSAGES_METRIC_DESC Received messages metric description.- See Also:
- Constant Field Values
 
 - 
SENT_MESSAGES_BY_TYPE_METRIC_NAMEpublic static final String SENT_MESSAGES_BY_TYPE_METRIC_NAME Sent messages by type metric name.- See Also:
- Constant Field Values
 
 - 
SENT_MESSAGES_BY_TYPE_METRIC_DESCpublic static final String SENT_MESSAGES_BY_TYPE_METRIC_DESC Sent messages by type metric description.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_BY_TYPE_METRIC_NAMEpublic static final String RECEIVED_MESSAGES_BY_TYPE_METRIC_NAME Received messages by type metric name.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_BY_TYPE_METRIC_DESCpublic static final String RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC Received messages by type metric description.- See Also:
- Constant Field Values
 
 - 
SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAMEpublic static final String SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME Sent messages by node consistent id metric name.- See Also:
- Constant Field Values
 
 - 
SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESCpublic static final String SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC Sent messages by node consistent id metric description.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAMEpublic static final String RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME Received messages by node consistent id metric name.- See Also:
- Constant Field Values
 
 - 
RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESCpublic static final String RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_DESC Received messages by node consistent id metric description.- See Also:
- Constant Field Values
 
 - 
DISABLED_CLIENT_PORTpublic static final Integer DISABLED_CLIENT_PORT Client nodes might have port0if they have no server socket opened.
 - 
ATTR_FORCE_CLIENT_SERVER_CONNECTIONSpublic static final String ATTR_FORCE_CLIENT_SERVER_CONNECTIONS - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setListener@Deprecated public void setListener(CommunicationListener<Message> lsnr) Deprecated.Set communication listener. This call should be change after refactoring. It produces dependency hell. BecauseGridIoManagerset it after self construct.- Parameters:
- lsnr- Listener to set or- nullto unset the listener.
 
 - 
getListenerpublic CommunicationListener getListener() - Returns:
- Listener.
 
 - 
getSentMessagesCountpublic int getSentMessagesCount() Gets sent messages count.- Returns:
- Sent messages count.
 
 - 
getSentBytesCountpublic long getSentBytesCount() Gets sent bytes count.- Returns:
- Sent bytes count.
 
 - 
getReceivedMessagesCountpublic int getReceivedMessagesCount() Gets received messages count.- Returns:
- Received messages count.
 
 - 
getReceivedBytesCountpublic long getReceivedBytesCount() Gets received bytes count.- Returns:
- Received bytes count.
 
 - 
getReceivedMessagesByTypepublic Map<String,Long> getReceivedMessagesByType() Gets received messages counts (grouped by type).- Returns:
- Map containing message types and respective counts.
 
 - 
getReceivedMessagesByNodepublic Map<UUID,Long> getReceivedMessagesByNode() Gets received messages counts (grouped by node).- Returns:
- Map containing sender nodes and respective counts.
 
 - 
getSentMessagesByTypepublic Map<String,Long> getSentMessagesByType() Gets sent messages counts (grouped by type).- Returns:
- Map containing message types and respective counts.
 
 - 
getSentMessagesByNodepublic Map<UUID,Long> getSentMessagesByNode() Gets sent messages counts (grouped by node).- Returns:
- Map containing receiver nodes and respective counts.
 
 - 
getOutboundMessagesQueueSizepublic int getOutboundMessagesQueueSize() Gets outbound messages queue size.- Returns:
- Outbound messages queue size.
 
 - 
resetMetricspublic void resetMetrics() Resets metrics for this SPI instance.
 - 
dumpNodeStatisticspublic org.apache.ignite.internal.IgniteInternalFuture<String> dumpNodeStatistics(UUID nodeId) - Parameters:
- nodeId- Target node ID.
- Returns:
- Future.
 
 - 
dumpStatspublic void dumpStats() Dumps SPI per-connection stats to logs.
 - 
spiStartpublic void spiStart(String igniteInstanceName) throws IgniteSpiException This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- 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.
 
 - 
onContextInitialized0public 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.
 
 - 
getSpiContextpublic IgniteSpiContext getSpiContext() Gets SPI context.- Overrides:
- getSpiContextin class- IgniteSpiAdapter
- Returns:
- SPI context.
 
 - 
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. - Throws:
- IgniteSpiException- Thrown in case of any error during SPI stop.
 
 - 
onContextDestroyed0protected void onContextDestroyed0() Method to be called in the beginning of onContextDestroyed() method.- Overrides:
- onContextDestroyed0in class- IgniteSpiAdapter
 
 - 
onClientDisconnectedpublic void onClientDisconnected(IgniteFuture<?> reconnectFut) Client node disconnected callback.- Specified by:
- onClientDisconnectedin interface- IgniteSpi
- Overrides:
- onClientDisconnectedin class- IgniteSpiAdapter
- Parameters:
- reconnectFut- Future that will be completed when client reconnected.
 
 - 
onClientReconnectedpublic void onClientReconnected(boolean clusterRestarted) Client node reconnected callback.- Specified by:
- onClientReconnectedin interface- IgniteSpi
- Overrides:
- onClientReconnectedin class- IgniteSpiAdapter
- Parameters:
- clusterRestarted-- Trueif all cluster nodes restarted while client was disconnected.
 
 - 
checkConfigurationConsistency0protected void checkConfigurationConsistency0(IgniteSpiContext spiCtx, ClusterNode node, boolean starting) throws IgniteSpiException Method which is called in the end of checkConfigurationConsistency() method. May be overriden in SPIs.- Overrides:
- checkConfigurationConsistency0in class- IgniteSpiAdapter
- Parameters:
- spiCtx- SPI context.
- node- Remote node.
- starting- If this node is starting or not.
- Throws:
- IgniteSpiException- in case of errors.
 
 - 
openChannelpublic org.apache.ignite.internal.IgniteInternalFuture<Channel> openChannel(ClusterNode remote, Message initMsg) throws IgniteSpiException - Parameters:
- remote- Destination cluster node to communicate with.
- initMsg- Configuration channel attributes wrapped into the message.
- Returns:
- The future, which will be finished on channel ready.
- Throws:
- IgniteSpiException- If fails.
 
 - 
sendMessagepublic void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException Sends given message to destination node. Note that characteristics of the exchange such as durability, guaranteed delivery or error notification is dependant on SPI implementation.- Parameters:
- node- Destination node.
- msg- Message to send.
- Throws:
- IgniteSpiException- Thrown in case of any error during sending the message. Note that this is not guaranteed that failed communication will result in thrown exception as this is dependant on SPI implementation.
 
 - 
checkConnectionpublic IgniteFuture<BitSet> checkConnection(List<ClusterNode> nodes) - Parameters:
- nodes- Nodes to check connection with.
- Returns:
- Result future (each bit in result BitSet contains connection status to corresponding node).
 
 - 
sendMessagepublic void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) throws IgniteSpiException Sends given message to destination node. Note that characteristics of the exchange such as durability, guaranteed delivery or error notification is dependant on SPI implementation.- Parameters:
- node- Destination node.
- msg- Message to send.
- ackC- Ack closure.
- Throws:
- IgniteSpiException- Thrown in case of any error during sending the message. Note that this is not guaranteed that failed communication will result in thrown exception as this is dependant on SPI implementation.
 
 - 
nodeAddressespublic Collection<InetSocketAddress> nodeAddresses(ClusterNode node, boolean filterReachableAddrs) throws IgniteCheckedException - Parameters:
- node- Node.
- filterReachableAddrs- Filter addresses flag.
- Returns:
- Node addresses.
- Throws:
- IgniteCheckedException- If node does not have addresses.
 
 - 
createTcpClientprotected org.apache.ignite.internal.util.nio.GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException Establish TCP connection to remote node and returns client.- Parameters:
- node- Remote node.
- connIdx- Connection index.
- Returns:
- Client.
- Throws:
- IgniteCheckedException- If failed.
 
 - 
processSessionCreationErrorprotected void processSessionCreationError(ClusterNode node, Collection<InetSocketAddress> addrs, IgniteCheckedException errs) throws IgniteCheckedException Process errors if TCP/IPGridNioSessioncreation to remote node hasn't been performed.- Parameters:
- node- Remote node.
- addrs- Remote node addresses.
- errs- TCP client creation errors.
- Throws:
- IgniteCheckedException- If failed.
 
 - 
notifyListenerprotected void notifyListener(UUID sndId, Message msg, IgniteRunnable msgC) - Parameters:
- sndId- Sender ID.
- msg- Communication message.
- msgC- Closure to call when message processing finished.
 
 - 
simulateNodeFailure@TestOnly @Deprecated public void simulateNodeFailure() Deprecated.you should you DI and get instances of [nioSrvWrapper, commWorker, clientPool] via it.Stops service threads to simulate node failure. FOR TEST PURPOSES ONLY!!!
 - 
writeMessageTypepublic static void writeMessageType(ByteBuffer buf, short type) Write message type to byte buffer.- Parameters:
- buf- Byte buffer.
- type- Message type.
 
 - 
makeMessageTypepublic static short makeMessageType(byte b0, byte b1)Concatenates the two parameter bytes to form a message type value.- Parameters:
- b0- The first byte.
- b1- The second byte.
- Returns:
- Message type.
 
 
- 
 
-