Class GridTcpRouterConfiguration


  • public class GridTcpRouterConfiguration
    extends Object
    This class defines runtime configuration for TCP router.

    Note that you should only set values that differ from defaults, as router will automatically pick default values for all values that are not set.

    For more information about router configuration and startup refer to GridRouterFactory documentation.

    • Field Detail

      • DFLT_SERVERS

        public static final Collection<String> DFLT_SERVERS
        Default servers to which router will try to connect.
      • DFLT_TCP_PORT

        public static final int DFLT_TCP_PORT
        Default TCP port. The next port number after Grid's default is used.
        See Also:
        Constant Field Values
      • DFLT_PORT_RANGE

        public static final int DFLT_PORT_RANGE
        Default port range.
        See Also:
        Constant Field Values
      • DFLT_TCP_NODELAY

        public static final boolean DFLT_TCP_NODELAY
        Default nodelay.
        See Also:
        Constant Field Values
    • Constructor Detail

      • GridTcpRouterConfiguration

        public GridTcpRouterConfiguration()
    • Method Detail

      • getHost

        public String getHost()
        Gets TCP host or IP address for router to bind to.

        If not defined, router will try to bind to all interfaces.

        Returns:
        TCP host.
      • getPort

        public int getPort()
        Gets port for TCP binary protocol server.

        Default is DFLT_TCP_PORT.

        Returns:
        TCP port.
      • getPortRange

        public int getPortRange()
        Gets port range for TCP binary protocol server. If port number returned from getPort() is busy then ports withing this range will be tried.

        Note: zero-range means only user-specified port will be used.

        Default is DFLT_PORT_RANGE.

        Returns:
        TCP port.
      • isNoDelay

        public boolean isNoDelay()
        Gets flag indicating whether TCP_NODELAY option should be set for accepted client connections. Setting this option reduces network latency and should be set to true in majority of cases. For more information, see Socket.setTcpNoDelay(boolean)

        If not specified, default value is true.

        Returns:
        Whether TCP_NODELAY option should be enabled.
      • getIdleTimeout

        public long getIdleTimeout()
        Gets timeout in milliseconds to consider connection idle. If no messages sent by client within this interval router closes idling connection.

        If not specified, default value is ConnectorConfiguration.DFLT_IDLE_TIMEOUT.

        Returns:
        Idle timeout.
      • isSslClientAuth

        public boolean isSslClientAuth()
        Gets a flag indicating whether or not remote clients will be required to have a valid SSL certificate which validity will be verified with trust manager.
        Returns:
        Whether or not client authentication is required.
      • getSslContextFactory

        @Nullable
        public @Nullable javax.cache.configuration.Factory<SSLContext> getSslContextFactory()
        Gets SSL context factory that will be used for creating a secure socket layer of both rest binary server and out coming connections.
        Returns:
        SslContextFactory instance.
      • getServers

        public Collection<String> getServers()
        Gets list of server addresses to which router should try to connect to.

        Node that this list will be used only for initial grid connectivity. Once connected to the grid, router may establish connections to any grid node.

        Returns:
        List of server addresses.
      • getLogger

        public IgniteLogger getLogger()
        Gets logger for the router instance. If no logger provided JDK logging will be used by router implementation.
        Returns:
        Logger or null if no logger provided by configuration.
      • getSecurityCredentialsProvider

        @Nullable
        public @Nullable SecurityCredentialsProvider getSecurityCredentialsProvider()
        Gets credentials provider for grid access.

        This credentials will be used only for initial connection and topology discovery by the router, not for client's request authorization.

        Returns:
        Credentials.
      • setPort

        public GridTcpRouterConfiguration setPort​(int port)
        Sets port for router.
        Parameters:
        port - Port.
        Returns:
        this for chaining.
      • setPortRange

        public GridTcpRouterConfiguration setPortRange​(int portRange)
        Sets port range router will be allowed to try.

        Note: zero-range means only user-specified port will be used.

        Parameters:
        portRange - Port range.
        Returns:
        this for chaining.
        See Also:
        DFLT_PORT_RANGE
      • setNoDelay

        public GridTcpRouterConfiguration setNoDelay​(boolean noDelay)
        Sets flag indicating whether TCP_NODELAY option should be set for accepted client connections.
        Parameters:
        noDelay - No delay.
        Returns:
        this for chaining.
      • setIdleTimeout

        public GridTcpRouterConfiguration setIdleTimeout​(long idleTimeout)
        Sets idle timeout.
        Parameters:
        idleTimeout - Idle timeout in milliseconds.
        Returns:
        this for chaining.
      • setSslClientAuth

        public GridTcpRouterConfiguration setSslClientAuth​(boolean sslClientAuth)
        Sets flag indicating whether or not remote clients will be required to have a valid SSL certificate which validity will be verified with trust manager.
        Parameters:
        sslClientAuth - Ssl client auth.
        Returns:
        this for chaining.
      • setSslContextFactory

        public GridTcpRouterConfiguration setSslContextFactory​(javax.cache.configuration.Factory<SSLContext> sslCtxFactory)
        Sets SSL context factory that will be used for creating a secure socket layer of both rest binary server and out coming connections.
        Parameters:
        sslCtxFactory - Ssl context factory.
        Returns:
        this for chaining.
      • setServers

        public GridTcpRouterConfiguration setServers​(Collection<String> srvrs)
        Sets list of server addresses where router's embedded client should connect.
        Parameters:
        srvrs - List of servers.
        Returns:
        this for chaining.
      • setSecurityCredentialsProvider

        public GridTcpRouterConfiguration setSecurityCredentialsProvider​(SecurityCredentialsProvider credsProvider)
        Sets credentials provider for grid access.
        Parameters:
        credsProvider - Credentials provider.
        Returns:
        this for chaining.