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
GridRouterFactorydocumentation.
-
-
Field Summary
Fields Modifier and Type Field Description static intDFLT_PORT_RANGEDefault port range.static Collection<String>DFLT_SERVERSDefault servers to which router will try to connect.static StringDFLT_TCP_HOSTDefault TCP host for router to bind to.static booleanDFLT_TCP_NODELAYDefault nodelay.static intDFLT_TCP_PORTDefault TCP port.
-
Constructor Summary
Constructors Constructor Description GridTcpRouterConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetHost()Gets TCP host or IP address for router to bind to.longgetIdleTimeout()Gets timeout in milliseconds to consider connection idle.IgniteLoggergetLogger()Gets logger for the router instance.intgetPort()Gets port for TCP binary protocol server.intgetPortRange()Gets port range for TCP binary protocol server.@Nullable SecurityCredentialsProvidergetSecurityCredentialsProvider()Gets credentials provider for grid access.Collection<String>getServers()Gets list of server addresses to which router should try to connect to.@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.booleanisNoDelay()Gets flag indicating whetherTCP_NODELAYoption should be set for accepted client connections.booleanisSslClientAuth()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.GridTcpRouterConfigurationsetHost(String host)Sets host for router.GridTcpRouterConfigurationsetIdleTimeout(long idleTimeout)Sets idle timeout.GridTcpRouterConfigurationsetLogger(IgniteLogger log)Sets logger for the router instance.GridTcpRouterConfigurationsetNoDelay(boolean noDelay)Sets flag indicating whetherTCP_NODELAYoption should be set for accepted client connections.GridTcpRouterConfigurationsetPort(int port)Sets port for router.GridTcpRouterConfigurationsetPortRange(int portRange)Sets port range router will be allowed to try.GridTcpRouterConfigurationsetSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider)Sets credentials provider for grid access.GridTcpRouterConfigurationsetServers(Collection<String> srvrs)Sets list of server addresses where router's embedded client should connect.GridTcpRouterConfigurationsetSslClientAuth(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.GridTcpRouterConfigurationsetSslContextFactory(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.StringtoString()
-
-
-
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
-
-
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 fromgetPort()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 whetherTCP_NODELAYoption should be set for accepted client connections. Setting this option reduces network latency and should be set totruein majority of cases. For more information, seeSocket.setTcpNoDelay(boolean)If not specified, default value istrue.- Returns:
- Whether
TCP_NODELAYoption 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 isConnectorConfiguration.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
nullif 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.
-
setHost
public GridTcpRouterConfiguration setHost(String host)
Sets host for router.- Parameters:
host- Host.- Returns:
thisfor chaining.
-
setPort
public GridTcpRouterConfiguration setPort(int port)
Sets port for router.- Parameters:
port- Port.- Returns:
thisfor 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:
thisfor chaining.- See Also:
DFLT_PORT_RANGE
-
setNoDelay
public GridTcpRouterConfiguration setNoDelay(boolean noDelay)
Sets flag indicating whetherTCP_NODELAYoption should be set for accepted client connections.- Parameters:
noDelay- No delay.- Returns:
thisfor chaining.
-
setIdleTimeout
public GridTcpRouterConfiguration setIdleTimeout(long idleTimeout)
Sets idle timeout.- Parameters:
idleTimeout- Idle timeout in milliseconds.- Returns:
thisfor 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:
thisfor 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:
thisfor 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:
thisfor chaining.
-
setLogger
public GridTcpRouterConfiguration setLogger(IgniteLogger log)
Sets logger for the router instance.- Parameters:
log- Logger.- Returns:
thisfor chaining.
-
setSecurityCredentialsProvider
public GridTcpRouterConfiguration setSecurityCredentialsProvider(SecurityCredentialsProvider credsProvider)
Sets credentials provider for grid access.- Parameters:
credsProvider- Credentials provider.- Returns:
thisfor chaining.
-
-