Class TcpCommunicationSpiMBeanImpl
- java.lang.Object
-
- org.apache.ignite.spi.IgniteSpiMBeanAdapter
-
- org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationSpiMBeanImpl
-
- All Implemented Interfaces:
TcpCommunicationSpiMBean,IgniteSpiManagementMBean
public class TcpCommunicationSpiMBeanImpl extends IgniteSpiMBeanAdapter implements TcpCommunicationSpiMBean
MBean implementation for TcpCommunicationSpi.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.spi.IgniteSpiMBeanAdapter
spiAdapter
-
-
Constructor Summary
Constructors Constructor Description TcpCommunicationSpiMBeanImpl(IgniteSpiAdapter spiAdapter, TcpCommunicationMetricsListener metricsLsnr, TcpCommunicationConfiguration cfg, ClusterStateProvider stateProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpStats()Dumps SPI per-connection stats to logs.intgetAckSendThreshold()Gets number of received messages per connection to node after which acknowledgment message is sent.intgetConnectionsPerNode()Gets number of connections to each remote node. ifTcpCommunicationSpiMBean.isUsePairedConnections()istruethen number of connections is doubled and half is used for incoming and half for outgoing messages.longgetConnectTimeout()Gets connect timeout used when establishing connection with remote nodes.longgetIdleConnectionTimeout()Gets maximum idle connection time upon which idle connections will be closed.StringgetLocalAddress()Gets local host address for socket binding.intgetLocalPort()Gets local port for socket binding.intgetLocalPortRange()Gets maximum number of local ports tried if all previously tried ports are occupied.longgetMaxConnectTimeout()Gets maximum connect timeout.intgetMessageQueueLimit()Gets message queue limit for incoming and outgoing messages.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.intgetReconnectCount()Gets maximum number of reconnect attempts used when establishing connection with remote nodes.intgetSelectorsCount()Gets count of selectors used in TCP server.longgetSelectorSpins()Defines how many non-blockingselector.selectNow()should be made before falling intoselector.select(long)in NIO server.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.intgetSharedMemoryPort()intgetSlowClientQueueLimit()Gets slow client queue limit.intgetSocketReceiveBuffer()Gets receive buffer size for sockets created or accepted by this SPI.intgetSocketSendBuffer()Gets send buffer size for sockets created or accepted by this SPI.longgetSocketWriteTimeout()Gets socket write timeout for TCP connections.intgetUnacknowledgedMessagesBufferSize()Gets maximum number of stored unacknowledged messages per connection to node.booleanisDirectBuffer()Gets flag that indicates whether direct or heap allocated buffer is used.booleanisDirectSendBuffer()Gets flag defining whether direct send buffer should be used.booleanisTcpNoDelay()Gets value forTCP_NODELAYsocket option.booleanisUsePairedConnections()ReturnstrueifTcpCommunicationSpishould maintain connection for outgoing and incoming messages separately.-
Methods inherited from class org.apache.ignite.spi.IgniteSpiMBeanAdapter
getIgniteHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.spi.IgniteSpiManagementMBean
getIgniteHome, getLocalNodeId, getName, getStartTimestamp, getStartTimestampFormatted, getUpTime, getUpTimeFormatted
-
-
-
-
Constructor Detail
-
TcpCommunicationSpiMBeanImpl
public TcpCommunicationSpiMBeanImpl(IgniteSpiAdapter spiAdapter, TcpCommunicationMetricsListener metricsLsnr, TcpCommunicationConfiguration cfg, ClusterStateProvider stateProvider)
- Parameters:
spiAdapter- Spi adapter.metricsLsnr- Metrics listener.cfg- Config.stateProvider- State provider.
-
-
Method Detail
-
getLocalAddress
public String getLocalAddress()
Gets local host address for socket binding. Beside loopback address physical node could have several other ones, but only one is assigned to grid node.- Specified by:
getLocalAddressin interfaceTcpCommunicationSpiMBean- Returns:
- Grid node IP address.
-
getLocalPort
public int getLocalPort()
Gets local port for socket binding.- Specified by:
getLocalPortin interfaceTcpCommunicationSpiMBean- Returns:
- Port number.
-
getLocalPortRange
public int getLocalPortRange()
Gets maximum number of local ports tried if all previously tried ports are occupied.- Specified by:
getLocalPortRangein interfaceTcpCommunicationSpiMBean- Returns:
- Local port range.
-
isUsePairedConnections
public boolean isUsePairedConnections()
ReturnstrueifTcpCommunicationSpishould maintain connection for outgoing and incoming messages separately. In this case total number of connections between local and some remote node isTcpCommunicationSpiMBean.getConnectionsPerNode()* 2.Returns
falseif each connection ofTcpCommunicationSpiMBean.getConnectionsPerNode()should be used for outgoing and incoming messages.Default is
false.- Specified by:
isUsePairedConnectionsin interfaceTcpCommunicationSpiMBean- Returns:
trueto use paired connections andfalseotherwise.- See Also:
TcpCommunicationSpiMBean.getConnectionsPerNode()
-
getConnectionsPerNode
public int getConnectionsPerNode()
Gets number of connections to each remote node. ifTcpCommunicationSpiMBean.isUsePairedConnections()istruethen number of connections is doubled and half is used for incoming and half for outgoing messages.- Specified by:
getConnectionsPerNodein interfaceTcpCommunicationSpiMBean- Returns:
- Number of connections per node.
- See Also:
TcpCommunicationSpiMBean.isUsePairedConnections()
-
getSharedMemoryPort
public int getSharedMemoryPort()
- Specified by:
getSharedMemoryPortin interfaceTcpCommunicationSpiMBean- Returns:
- Ignored value.
-
getIdleConnectionTimeout
public long getIdleConnectionTimeout()
Gets maximum idle connection time upon which idle connections will be closed.- Specified by:
getIdleConnectionTimeoutin interfaceTcpCommunicationSpiMBean- Returns:
- Maximum idle connection time.
-
getSocketWriteTimeout
public long getSocketWriteTimeout()
Gets socket write timeout for TCP connections. If message can not be written to socket within this time then connection is closed and reconnect is attempted.- Specified by:
getSocketWriteTimeoutin interfaceTcpCommunicationSpiMBean- Returns:
- Socket write timeout for TCP connections.
-
getAckSendThreshold
public int getAckSendThreshold()
Gets number of received messages per connection to node after which acknowledgment message is sent.- Specified by:
getAckSendThresholdin interfaceTcpCommunicationSpiMBean- Returns:
- Number of received messages after which acknowledgment is sent.
-
getUnacknowledgedMessagesBufferSize
public int getUnacknowledgedMessagesBufferSize()
Gets maximum number of stored unacknowledged messages per connection to node. If number of unacknowledged messages exceeds this number then connection to node is closed and reconnect is attempted.- Specified by:
getUnacknowledgedMessagesBufferSizein interfaceTcpCommunicationSpiMBean- Returns:
- Maximum number of unacknowledged messages.
-
getConnectTimeout
public long getConnectTimeout()
Gets connect timeout used when establishing connection with remote nodes.- Specified by:
getConnectTimeoutin interfaceTcpCommunicationSpiMBean- Returns:
- Connect timeout.
-
getMaxConnectTimeout
public long getMaxConnectTimeout()
Gets maximum connect timeout.- Specified by:
getMaxConnectTimeoutin interfaceTcpCommunicationSpiMBean- Returns:
- Maximum connect timeout.
-
getReconnectCount
public int getReconnectCount()
Gets maximum number of reconnect attempts used when establishing connection with remote nodes.- Specified by:
getReconnectCountin interfaceTcpCommunicationSpiMBean- Returns:
- Reconnects count.
-
isDirectBuffer
public boolean isDirectBuffer()
Gets flag that indicates whether direct or heap allocated buffer is used.- Specified by:
isDirectBufferin interfaceTcpCommunicationSpiMBean- Returns:
- Flag that indicates whether direct or heap allocated buffer is used.
-
isDirectSendBuffer
public boolean isDirectSendBuffer()
Gets flag defining whether direct send buffer should be used.- Specified by:
isDirectSendBufferin interfaceTcpCommunicationSpiMBean- Returns:
Trueif direct buffers should be used.
-
getSelectorsCount
public int getSelectorsCount()
Gets count of selectors used in TCP server. Default value equals to the number of CPUs available in the system.- Specified by:
getSelectorsCountin interfaceTcpCommunicationSpiMBean- Returns:
- Count of selectors in TCP server.
-
getSelectorSpins
public long getSelectorSpins()
Defines how many non-blockingselector.selectNow()should be made before falling intoselector.select(long)in NIO server. Long value. Default is0. Can be set toLong.MAX_VALUEso selector threads will never block.- Specified by:
getSelectorSpinsin interfaceTcpCommunicationSpiMBean- Returns:
- Selector thread busy-loop iterations.
-
isTcpNoDelay
public boolean isTcpNoDelay()
Gets value forTCP_NODELAYsocket option.- Specified by:
isTcpNoDelayin interfaceTcpCommunicationSpiMBean- Returns:
Trueif TCP delay is disabled.
-
getSocketReceiveBuffer
public int getSocketReceiveBuffer()
Gets receive buffer size for sockets created or accepted by this SPI.If not provided, default is
TcpCommunicationSpi.DFLT_SOCK_BUF_SIZE.- Specified by:
getSocketReceiveBufferin interfaceTcpCommunicationSpiMBean- Returns:
- Socket receive buffer size.
-
getSocketSendBuffer
public int getSocketSendBuffer()
Gets send buffer size for sockets created or accepted by this SPI.If not provided, default is
TcpCommunicationSpi.DFLT_SOCK_BUF_SIZE.- Specified by:
getSocketSendBufferin interfaceTcpCommunicationSpiMBean- Returns:
- Socket send buffer size.
-
getMessageQueueLimit
public int getMessageQueueLimit()
Gets message queue limit for incoming and outgoing messages.- Specified by:
getMessageQueueLimitin interfaceTcpCommunicationSpiMBean- Returns:
- Send queue size limit.
-
getSlowClientQueueLimit
public int getSlowClientQueueLimit()
Gets slow client queue limit. When set to a positive number, communication SPI will monitor clients outbound queue sizes and will drop those clients whose queue exceeded this limit.- Specified by:
getSlowClientQueueLimitin interfaceTcpCommunicationSpiMBean- Returns:
- Slow client queue limit.
-
dumpStats
public void dumpStats()
Dumps SPI per-connection stats to logs.- Specified by:
dumpStatsin interfaceTcpCommunicationSpiMBean
-
getSentMessagesCount
public int getSentMessagesCount()
Gets sent messages count.- Specified by:
getSentMessagesCountin interfaceTcpCommunicationSpiMBean- Returns:
- Sent messages count.
-
getSentBytesCount
public long getSentBytesCount()
Gets sent bytes count.- Specified by:
getSentBytesCountin interfaceTcpCommunicationSpiMBean- Returns:
- Sent bytes count.
-
getReceivedMessagesCount
public int getReceivedMessagesCount()
Gets received messages count.- Specified by:
getReceivedMessagesCountin interfaceTcpCommunicationSpiMBean- Returns:
- Received messages count.
-
getReceivedBytesCount
public long getReceivedBytesCount()
Gets received bytes count.- Specified by:
getReceivedBytesCountin interfaceTcpCommunicationSpiMBean- Returns:
- Received bytes count.
-
getReceivedMessagesByType
public Map<String,Long> getReceivedMessagesByType()
Gets received messages counts (grouped by type).- Specified by:
getReceivedMessagesByTypein interfaceTcpCommunicationSpiMBean- Returns:
- Map containing message types and respective counts.
-
getReceivedMessagesByNode
public Map<UUID,Long> getReceivedMessagesByNode()
Gets received messages counts (grouped by node).- Specified by:
getReceivedMessagesByNodein interfaceTcpCommunicationSpiMBean- Returns:
- Map containing sender nodes and respective counts.
-
getSentMessagesByType
public Map<String,Long> getSentMessagesByType()
Gets sent messages counts (grouped by type).- Specified by:
getSentMessagesByTypein interfaceTcpCommunicationSpiMBean- Returns:
- Map containing message types and respective counts.
-
getSentMessagesByNode
public Map<UUID,Long> getSentMessagesByNode()
Gets sent messages counts (grouped by node).- Specified by:
getSentMessagesByNodein interfaceTcpCommunicationSpiMBean- Returns:
- Map containing receiver nodes and respective counts.
-
getOutboundMessagesQueueSize
public int getOutboundMessagesQueueSize()
Gets outbound messages queue size.- Specified by:
getOutboundMessagesQueueSizein interfaceTcpCommunicationSpiMBean- Returns:
- Outbound messages queue size.
-
-