Class TcpCommunicationConfigInitializer

    • Constructor Detail

      • TcpCommunicationConfigInitializer

        public TcpCommunicationConfigInitializer()
    • Method Detail

      • setLocalAddress

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setLocalAddress​(String locAddr)
        Sets local host address for socket binding. Note that one node could have additional addresses beside the loopback one. This configuration parameter is optional.
        Parameters:
        locAddr - IP address. Default value is any available local IP address.
        Returns:
        this for chaining.
      • getLocalPort

        public int getLocalPort()
        Returns:
        Port number.
      • setLocalPortRange

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setLocalPortRange​(int locPortRange)
        Sets local port range for local host ports (value must greater than or equal to 0). If provided local port (see 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.

        Parameters:
        locPortRange - New local port range.
        Returns:
        this for chaining.
      • isUsePairedConnections

        public boolean isUsePairedConnections()
        Returns:
        true to use paired connections and false otherwise.
      • setUsePairedConnections

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setUsePairedConnections​(boolean usePairedConnections)
        Set this to 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.

        Parameters:
        usePairedConnections - true to use paired connections and false otherwise.
        Returns:
        this for chaining.
        See Also:
        getConnectionsPerNode()
      • getConnectionsPerNode

        public int getConnectionsPerNode()
        Returns:
        Number of connections per node.
      • getSharedMemoryPort

        @Deprecated
        public int getSharedMemoryPort()
        Deprecated.
        This property is ignored and will be removed in future releases.
      • getSocketWriteTimeout

        public long getSocketWriteTimeout()
        Returns:
        Socket write timeout for TCP connections.
      • getAckSendThreshold

        public int getAckSendThreshold()
        Returns:
        Number of received messages after which acknowledgment is sent.
      • setUnacknowledgedMessagesBufferSize

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setUnacknowledgedMessagesBufferSize​(int unackedMsgsBufSize)
        Sets 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.
        Parameters:
        unackedMsgsBufSize - Maximum number of unacknowledged messages.
        Returns:
        this for chaining.
      • setMaxConnectTimeout

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setMaxConnectTimeout​(long maxConnTimeout)
        Sets maximum connect timeout. If handshake is not established within connect timeout, then SPI tries to repeat handshake procedure with increased connect timeout. Connect timeout can grow till maximum timeout value, if maximum timeout value is reached then the handshake is considered as failed.

        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.

        Parameters:
        maxConnTimeout - Maximum connect timeout.
        Returns:
        this for chaining.
      • getMaxConnectTimeout

        public long getMaxConnectTimeout()
        Gets maximum connect timeout.
        Returns:
        Maximum connect timeout.
      • getReconnectCount

        public int getReconnectCount()
        Gets maximum number of reconnect attempts used when establishing connection with remote nodes.
        Returns:
        Reconnects count.
      • isDirectBuffer

        public boolean isDirectBuffer()
        Gets flag that indicates whether direct or heap allocated buffer is used.
        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.
        Returns:
        True if direct buffers should be used.
      • setDirectSendBuffer

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setDirectSendBuffer​(boolean directSndBuf)
        Sets whether to use direct buffer for sending. If not provided default is false.
        Parameters:
        directSndBuf - True to use direct buffers for send.
        Returns:
        this for chaining.
      • getSelectorsCount

        public int getSelectorsCount()
        Returns:
        Count of selectors in TCP server.
      • getSelectorSpins

        public long getSelectorSpins()
        Returns:
        Selector thread busy-loop iterations.
      • setSelectorSpins

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setSelectorSpins​(long selectorSpins)
        Defines how many non-blocking 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.
        Parameters:
        selectorSpins - Selector thread busy-loop iterations.
        Returns:
        this for chaining.
      • setConnectionRequestor

        public void setConnectionRequestor​(ConnectionRequestor connectionRequestor)
      • setTcpNoDelay

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setTcpNoDelay​(boolean tcpNoDelay)
        Sets value for 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.

        Parameters:
        tcpNoDelay - True to disable TCP delay.
        Returns:
        this for chaining.
      • isTcpNoDelay

        public boolean isTcpNoDelay()
        Gets value for TCP_NODELAY socket option.
        Returns:
        True if TCP delay is disabled.
      • isFilterReachableAddresses

        public boolean isFilterReachableAddresses()
        Gets value for FILTER_REACHABLE_ADDRESSES socket option.
        Returns:
        True if needed to filter reachable addresses.
      • getSocketSendBuffer

        public int getSocketSendBuffer()
        Returns:
        Socket send buffer size.
      • setMessageQueueLimit

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setMessageQueueLimit​(int msgQueueLimit)
        Sets message queue limit for incoming and outgoing messages.

        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.

        Parameters:
        msgQueueLimit - Send queue size limit.
        Returns:
        this for chaining.
      • getMessageQueueLimit

        public int getMessageQueueLimit()
        Gets message queue limit for incoming and outgoing messages.
        Returns:
        Send queue size limit.
      • failureDetectionTimeoutEnabled

        public void failureDetectionTimeoutEnabled​(boolean enabled)
        Enables or disables failure detection timeout.
        Overrides:
        failureDetectionTimeoutEnabled in class IgniteSpiAdapter
        Parameters:
        enabled - true if enable, false otherwise.
      • failureDetectionTimeout

        public long failureDetectionTimeout()
        Returns failure detection timeout set to use for network related operations.
        Overrides:
        failureDetectionTimeout in class IgniteSpiAdapter
        Returns:
        failure detection timeout in milliseconds or 0 if the timeout is disabled.
      • setForceClientToServerConnections

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setForceClientToServerConnections​(boolean forceClientToSrvConnections)
        Applicable for clients only. Sets PSI in the mode when server node cannot open TCP connection to the current node. Possile reasons for that may be specific network configurations or security rules. In this mode, when server needs the connection with client, it uses DiscoverySpi protocol to notify client about it. After that client opens the required connection from its side.
      • setSlowClientQueueLimit

        @IgniteSpiConfiguration(optional=true)
        public TcpCommunicationSpi setSlowClientQueueLimit​(int slowClientQueueLimit)
        Sets slow client queue limit.

        When set to a positive number, communication SPI will monitor clients outbound message queue sizes and will drop those clients whose queue exceeded this limit.

        This value should be set to less or equal value than getMessageQueueLimit() which controls message back-pressure for server nodes. The default value for this parameter is 0 which means unlimited.

        Parameters:
        slowClientQueueLimit - Slow client queue limit.
        Returns:
        this for chaining.
      • boundPort

        public int boundPort()
        Returns:
        Bound TCP server port.