public abstract class TcpCommunicationConfigInitializer extends IgniteSpiAdapter implements CommunicationSpi<Message>
| Modifier and Type | Field and Description |
|---|---|
protected AttributeNames |
attributeNames
Attribute names.
|
protected TcpCommunicationConfiguration |
cfg
Config.
|
protected ConnectionPolicy |
connPlc
Connection policy.
|
protected TcpCommunicationMetricsListener |
metricsLsnr
Statistics.
|
protected IpcSharedMemoryServerEndpoint |
shmemSrv
Shared memory server.
|
protected Tracing |
tracing
Tracing.
|
ignite, igniteInstanceName, log| Constructor and Description |
|---|
TcpCommunicationConfigInitializer() |
| Modifier and Type | Method and Description |
|---|---|
int |
boundPort() |
long |
failureDetectionTimeout()
Returns failure detection timeout set to use for network related operations.
|
boolean |
failureDetectionTimeoutEnabled()
Checks whether failure detection timeout is enabled for this
IgniteSpi. |
void |
failureDetectionTimeoutEnabled(boolean enabled)
Enables or disables failure detection timeout.
|
boolean |
forceClientToServerConnections() |
int |
getAckSendThreshold()
|
AddressResolver |
getAddressResolver()
|
int |
getConnectionsPerNode()
|
long |
getConnectTimeout()
|
long |
getIdleConnectionTimeout()
|
String |
getLocalAddress()
|
int |
getLocalPort()
See
setLocalPort(int). |
int |
getLocalPortRange()
|
long |
getMaxConnectTimeout()
Gets maximum connect timeout.
|
int |
getMessageQueueLimit()
Gets message queue limit for incoming and outgoing messages.
|
Map<String,Object> |
getNodeAttributes()
This method is called before SPI starts (before method
IgniteSpi.spiStart(String)
is called). |
int |
getReconnectCount()
Gets maximum number of reconnect attempts used when establishing connection
with remote nodes.
|
int |
getSelectorsCount()
|
long |
getSelectorSpins()
|
int |
getSharedMemoryPort()
|
int |
getSlowClientQueueLimit()
|
int |
getSocketReceiveBuffer()
|
int |
getSocketSendBuffer()
|
long |
getSocketWriteTimeout()
|
int |
getUnacknowledgedMessagesBufferSize()
|
protected void |
injectResources(Ignite ignite)
Injects resources.
|
boolean |
isDirectBuffer()
Gets flag that indicates whether direct or heap allocated buffer is used.
|
boolean |
isDirectSendBuffer()
Gets flag defining whether direct send buffer should be used.
|
boolean |
isFilterReachableAddresses()
Gets value for
FILTER_REACHABLE_ADDRESSES socket option. |
boolean |
isTcpNoDelay()
Gets value for
TCP_NODELAY socket option. |
boolean |
isUsePairedConnections()
|
protected @Nullable IpcSharedMemoryServerEndpoint |
resetShmemServer()
Creates new shared memory communication server.
|
TcpCommunicationSpi |
setAckSendThreshold(int ackSndThreshold)
Sets number of received messages per connection to node after which acknowledgment message is sent.
|
TcpCommunicationSpi |
setAddressResolver(AddressResolver addrRslvr)
Sets address resolver.
|
void |
setConnectionRequestor(ConnectionRequestor connectionRequestor) |
TcpCommunicationSpi |
setConnectionsPerNode(int maxConnectionsPerNode)
Sets number of connections to each remote node. if
isUsePairedConnections()
is true then number of connections is doubled and half is used for incoming and
half for outgoing messages. |
TcpCommunicationSpi |
setConnectTimeout(long connTimeout)
Sets connect timeout used when establishing connection
with remote nodes.
|
TcpCommunicationSpi |
setDirectBuffer(boolean directBuf)
Sets flag to allocate direct or heap buffer in SPI.
|
TcpCommunicationSpi |
setDirectSendBuffer(boolean directSndBuf)
Sets whether to use direct buffer for sending.
|
TcpCommunicationSpi |
setFilterReachableAddresses(boolean filterReachableAddresses)
Setting this option to
true enables filter for reachable
addresses on creating tcp client. |
TcpCommunicationSpi |
setForceClientToServerConnections(boolean forceClientToSrvConnections)
Applicable for clients only.
|
TcpCommunicationSpi |
setIdleConnectionTimeout(long idleConnTimeout)
Sets maximum idle connection timeout upon which a connection
to client will be closed.
|
TcpCommunicationSpi |
setLocalAddress(String locAddr)
Sets local host address for socket binding.
|
TcpCommunicationSpi |
setLocalPort(int locPort)
Sets local port for socket binding.
|
TcpCommunicationSpi |
setLocalPortRange(int locPortRange)
Sets local port range for local host ports (value must greater than or equal to 0).
|
TcpCommunicationSpi |
setMaxConnectTimeout(long maxConnTimeout)
Sets maximum connect timeout.
|
TcpCommunicationSpi |
setMessageQueueLimit(int msgQueueLimit)
Sets message queue limit for incoming and outgoing messages.
|
TcpCommunicationSpi |
setName(String name)
Sets SPI name.
|
TcpCommunicationSpi |
setReconnectCount(int reconCnt)
Sets maximum number of reconnect attempts used when establishing connection
with remote nodes.
|
TcpCommunicationSpi |
setSelectorsCount(int selectorsCnt)
Sets the count of selectors te be used in TCP server.
|
TcpCommunicationSpi |
setSelectorSpins(long selectorSpins)
Defines how many non-blocking
selector.selectNow() should be made before
falling into selector.select(long) in NIO server. |
TcpCommunicationSpi |
setSharedMemoryPort(int shmemPort)
Sets local port to accept shared memory connections.
|
TcpCommunicationSpi |
setSlowClientQueueLimit(int slowClientQueueLimit)
Sets slow client queue limit.
|
TcpCommunicationSpi |
setSocketReceiveBuffer(int sockRcvBuf)
Sets receive buffer size for sockets created or accepted by this SPI.
|
TcpCommunicationSpi |
setSocketSendBuffer(int sockSndBuf)
Sets send buffer size for sockets created or accepted by this SPI.
|
TcpCommunicationSpi |
setSocketWriteTimeout(long sockWriteTimeout)
Sets socket write timeout for TCP connection.
|
TcpCommunicationSpi |
setTcpNoDelay(boolean tcpNoDelay)
Sets value for
TCP_NODELAY socket option. |
TcpCommunicationSpi |
setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize)
Sets maximum number of stored unacknowledged messages per connection to node.
|
TcpCommunicationSpi |
setUsePairedConnections(boolean usePairedConnections)
Set this to
true if TcpCommunicationSpi should
maintain connection for outgoing and incoming messages separately. |
addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getSpiContext, ignite, initFailureDetectionTimeout, injectables, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, started, startInfo, startStopwatch, stopInfo, unregisterMBeanclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOutboundMessagesQueueSize, getReceivedBytesCount, getReceivedMessagesCount, getSentBytesCount, getSentMessagesCount, resetMetrics, sendMessage, setListenergetName, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized, spiStart, spiStopprotected final TcpCommunicationConfiguration cfg
protected AttributeNames attributeNames
protected IpcSharedMemoryServerEndpoint shmemSrv
protected TcpCommunicationMetricsListener metricsLsnr
protected ConnectionPolicy connPlc
protected Tracing tracing
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setAddressResolver(AddressResolver addrRslvr)
addrRslvr - Address resolver.this for chaining.public AddressResolver getAddressResolver()
@IgniteInstanceResource protected void injectResources(Ignite ignite)
injectResources in class IgniteSpiAdapterignite - Ignite.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setLocalAddress(String locAddr)
locAddr - IP address. Default value is any available local
IP address.this for chaining.public String getLocalAddress()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setLocalPort(int locPort)
If not provided, default value is TcpCommunicationSpi.DFLT_PORT.
locPort - Port number.this for chaining.public int getLocalPort()
setLocalPort(int).@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setLocalPortRange(int locPortRange)
setLocalPort(int)} is occupied,
implementation will try to increment the port number for as long as it is less than
initial value plus this range.
If port range value is 0, then implementation will try bind only to the port provided by
setLocalPort(int) method and fail if binding to this port did not succeed.
Local port range is very useful during development when more than one grid nodes need to run on the same physical machine.
If not provided, default value is TcpCommunicationSpi.DFLT_PORT_RANGE.
locPortRange - New local port range.this for chaining.public int getLocalPortRange()
public boolean isUsePairedConnections()
true to use paired connections and false otherwise.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setUsePairedConnections(boolean usePairedConnections)
true if TcpCommunicationSpi should
maintain connection for outgoing and incoming messages separately.
In this case total number of connections between local and each remote node
is getConnectionsPerNode() * 2.
Set this to false if each connection of getConnectionsPerNode()
should be used for outgoing and incoming messages. In this case total number
of connections between local and each remote node is getConnectionsPerNode().
Default is false.
usePairedConnections - true to use paired connections and false otherwise.this for chaining.getConnectionsPerNode()@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setConnectionsPerNode(int maxConnectionsPerNode)
isUsePairedConnections()
is true then number of connections is doubled and half is used for incoming and
half for outgoing messages.maxConnectionsPerNode - Number of connections per node.this for chaining.isUsePairedConnections()public int getConnectionsPerNode()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSharedMemoryPort(int shmemPort)
If set to -1 shared memory communication will be disabled.
If not provided, default value is TcpCommunicationSpi.DFLT_SHMEM_PORT.
shmemPort - Port number.this for chaining.public int getSharedMemoryPort()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setIdleConnectionTimeout(long idleConnTimeout)
If not provided, default value is TcpCommunicationSpi.DFLT_IDLE_CONN_TIMEOUT.
idleConnTimeout - Maximum idle connection time.this for chaining.public long getIdleConnectionTimeout()
public long getSocketWriteTimeout()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSocketWriteTimeout(long sockWriteTimeout)
Default to TcpCommunicationSpi.DFLT_SOCK_WRITE_TIMEOUT.
sockWriteTimeout - Socket write timeout for TCP connection.this for chaining.public int getAckSendThreshold()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setAckSendThreshold(int ackSndThreshold)
Default to TcpCommunicationSpi.DFLT_ACK_SND_THRESHOLD.
ackSndThreshold - Number of received messages after which acknowledgment is sent.this for chaining.public int getUnacknowledgedMessagesBufferSize()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setUnacknowledgedMessagesBufferSize(int unackedMsgsBufSize)
unackedMsgsBufSize - Maximum number of unacknowledged messages.this for chaining.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setConnectTimeout(long connTimeout)
0 is interpreted as infinite timeout.
If not provided, default value is TcpCommunicationSpi.DFLT_CONN_TIMEOUT.
When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout() is ignored.
connTimeout - Connect timeout.this for chaining.public long getConnectTimeout()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setMaxConnectTimeout(long maxConnTimeout)
0 is interpreted as infinite timeout.
If not provided, default value is TcpCommunicationSpi.DFLT_MAX_CONN_TIMEOUT.
When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout() is ignored.
maxConnTimeout - Maximum connect timeout.this for chaining.public long getMaxConnectTimeout()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setReconnectCount(int reconCnt)
If not provided, default value is TcpCommunicationSpi.DFLT_RECONNECT_CNT.
When this property is explicitly set IgniteConfiguration.getFailureDetectionTimeout() is ignored.
reconCnt - Maximum number of reconnection attempts.this for chaining.public int getReconnectCount()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setDirectBuffer(boolean directBuf)
true, then SPI will use ByteBuffer.allocateDirect(int) call.
Otherwise, SPI will use ByteBuffer.allocate(int) call.
If not provided, default value is true.
directBuf - Flag indicates to allocate direct or heap buffer in SPI.this for chaining.public boolean isDirectBuffer()
public boolean isDirectSendBuffer()
True if direct buffers should be used.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setDirectSendBuffer(boolean directSndBuf)
false.directSndBuf - True to use direct buffers for send.this for chaining.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSelectorsCount(int selectorsCnt)
TcpCommunicationSpi.DFLT_SELECTORS_CNT.selectorsCnt - Selectors count.this for chaining.public int getSelectorsCount()
public long getSelectorSpins()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSelectorSpins(long selectorSpins)
selector.selectNow() should be made before
falling into selector.select(long) in NIO server. Long value. Default is 0.
Can be set to Long.MAX_VALUE so selector threads will never block.selectorSpins - Selector thread busy-loop iterations.this for chaining.public void setConnectionRequestor(ConnectionRequestor connectionRequestor)
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setTcpNoDelay(boolean tcpNoDelay)
TCP_NODELAY socket option. Each
socket will be opened using provided value.
Setting this option to true disables Nagle's algorithm
for socket decreasing latency and delivery time for small messages.
For systems that work under heavy network load it is advisable to
set this value to false.
If not provided, default value is TcpCommunicationSpi.DFLT_TCP_NODELAY.
tcpNoDelay - True to disable TCP delay.this for chaining.public boolean isTcpNoDelay()
TCP_NODELAY socket option.True if TCP delay is disabled.public boolean isFilterReachableAddresses()
FILTER_REACHABLE_ADDRESSES socket option.True if needed to filter reachable addresses.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setFilterReachableAddresses(boolean filterReachableAddresses)
true enables filter for reachable
addresses on creating tcp client.
Usually its advised to set this value to false.
If not provided, default value is TcpCommunicationSpi.DFLT_FILTER_REACHABLE_ADDRESSES.
filterReachableAddresses - True to filter reachable addresses.this for chaining.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSocketReceiveBuffer(int sockRcvBuf)
If not provided, default is TcpCommunicationSpi.DFLT_SOCK_BUF_SIZE.
sockRcvBuf - Socket receive buffer size.this for chaining.public int getSocketReceiveBuffer()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSocketSendBuffer(int sockSndBuf)
If not provided, default is TcpCommunicationSpi.DFLT_SOCK_BUF_SIZE.
sockSndBuf - Socket send buffer size.this for chaining.public int getSocketSendBuffer()
@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setMessageQueueLimit(int msgQueueLimit)
When set to positive number send queue is limited to the configured value.
0 disables the size limitations.
If not provided, default is TcpCommunicationSpi.DFLT_MSG_QUEUE_LIMIT.
msgQueueLimit - Send queue size limit.this for chaining.public int getMessageQueueLimit()
public int getSlowClientQueueLimit()
public void failureDetectionTimeoutEnabled(boolean enabled)
failureDetectionTimeoutEnabled in class IgniteSpiAdapterenabled - true if enable, false otherwise.public boolean failureDetectionTimeoutEnabled()
IgniteSpi.failureDetectionTimeoutEnabled in class IgniteSpiAdaptertrue if enabled, false otherwise.public long failureDetectionTimeout()
failureDetectionTimeout in class IgniteSpiAdapter0 if the timeout is disabled.public boolean forceClientToServerConnections()
setForceClientToServerConnections(boolean)@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setForceClientToServerConnections(boolean forceClientToSrvConnections)
DiscoverySpi protocol to notify
client about it. After that client opens the required connection from its side.@IgniteSpiConfiguration(optional=true) public TcpCommunicationSpi setSlowClientQueueLimit(int slowClientQueueLimit)
getMessageQueueLimit() which controls
message back-pressure for server nodes. The default value for this parameter is 0
which means unlimited.slowClientQueueLimit - Slow client queue limit.this for chaining.public int boundPort()
public TcpCommunicationSpi setName(String name)
setName in class IgniteSpiAdaptername - SPI name.this for chaining.public Map<String,Object> getNodeAttributes() throws IgniteSpiException
IgniteSpi.spiStart(String)
is called). It allows SPI implementation to add attributes to a local
node. Kernal collects these attributes from all SPI implementations
loaded up and then passes it to discovery SPI so that they can be
exchanged with other nodes.getNodeAttributes in interface IgniteSpigetNodeAttributes in class IgniteSpiAdapterIgniteSpiException - Throws in case of any error.@Nullable protected @Nullable IpcSharedMemoryServerEndpoint resetShmemServer() throws IgniteCheckedException
IgniteCheckedException - If failed.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.11.1 Release Date : December 20 2021