org.apache.ignite.internal.client.router

## Class GridTcpRouterConfiguration

- java.lang.Object
- - org.apache.ignite.internal.client.router.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 Summary

Fields
`static int` `DFLT_PORT_RANGE` Default port range.
`static Collection<String>` `DFLT_SERVERS` Default servers to which router will try to connect.
`static String` `DFLT_TCP_HOST` Default TCP host for router to bind to.
`static boolean` `DFLT_TCP_NODELAY` Default nodelay.
`static int` `DFLT_TCP_PORT` Default TCP port.

### Constructor Summary

Constructors
Constructor and Description
`GridTcpRouterConfiguration()`

### Method Summary

Methods
`String` `getHost()` Gets TCP host or IP address for router to bind to.
`long` `getIdleTimeout()` Gets timeout in milliseconds to consider connection idle.
`IgniteLogger` `getLogger()` Gets logger for the router instance.
`int` `getPort()` Gets port for TCP binary protocol server.
`int` `getPortRange()` Gets port range for TCP binary protocol server.
`SecurityCredentialsProvider` `getSecurityCredentialsProvider()` Gets credentials provider for grid access.
`Collection<String>` `getServers()` Gets list of server addresses to which router should try to connect to.
`GridSslContextFactory` `getSslContextFactory()` Gets SSL context factory that will be used for creating a secure socket layer of both rest binary server and out coming connections.
`boolean` `isNoDelay()` Gets flag indicating whether `TCP_NODELAY` option should be set for accepted client connections.
`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.
`void` `setHost(String host)` Sets host for router.
`void` `setIdleTimeout(long idleTimeout)` Sets idle timeout.
`void` `setLogger(IgniteLogger log)` Sets logger for the router instance.
`void` `setNoDelay(boolean noDelay)` Sets flag indicating whether `TCP_NODELAY` option should be set for accepted client connections.
`void` `setPort(int port)` Sets port for router.
`void` `setPortRange(int portRange)` Sets port range router will be allowed to try.
`void` `setSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider)` Sets credentials provider for grid access.
`void` `setServers(Collection<String> srvrs)` Sets list of server addresses where router's embedded client should connect.
`void` `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.
`void` `setSslContextFactory(GridSslContextFactory sslCtxFactory)` Sets SSL context factory that will be used for creating a secure socket layer of both rest binary server and out coming connections.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### DFLT_SERVERS

    public static final Collection<String> DFLT_SERVERS

Default servers to which router will try to connect.

#### DFLT_TCP_HOST

    public static final String DFLT_TCP_HOST

Default TCP host for router to bind to.

See Also:
  Constant Field Values

#### 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 GridSslContextFactory 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.
See Also:
  `GridSslContextFactory`

#### 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 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.

#### setHost

    public void setHost(String host)

Sets host for router.

Parameters:
  `host` - Host.

#### setPort

    public void setPort(int port)

Sets port for router.

Parameters:
  `port` - Port.

#### setPortRange

    public void 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.
See Also:
  `DFLT_PORT_RANGE`

#### setNoDelay

    public void setNoDelay(boolean noDelay)

Sets flag indicating whether `TCP_NODELAY` option should be set for accepted client connections.

Parameters:
  `noDelay` - No delay.

#### setIdleTimeout

    public void setIdleTimeout(long idleTimeout)

Sets idle timeout.

Parameters:
  `idleTimeout` - Idle timeout in milliseconds.

#### setSslClientAuth

    public void 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.

#### setSslContextFactory

    public void setSslContextFactory(GridSslContextFactory 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.

#### setServers

    public void setServers(Collection<String> srvrs)

Sets list of server addresses where router's embedded client should connect.

Parameters:
  `srvrs` - List of servers.

#### setLogger

    public void setLogger(IgniteLogger log)

Sets logger for the router instance.

Parameters:
  `log` - Logger.

#### setSecurityCredentialsProvider

    public void setSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider)

Sets credentials provider for grid access.

Parameters:
  `credsProvider` - Credentials provider.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.1.0-incubating
Release Date | : May 20 2015