org.apache.ignite.configuration

## Class ConnectorConfiguration

- java.lang.Object
- - org.apache.ignite.configuration.ConnectorConfiguration

    public class ConnectorConfiguration
    extends Object

REST access configuration.

### Field Summary

Fields
`static int` `DFLT_IDLE_TIMEOUT` Default REST idle timeout.
`static long` `DFLT_KEEP_ALIVE_TIME` Default keep alive time for REST thread pool.
`static int` `DFLT_PORT_RANGE` Default rest port range.
`static int` `DFLT_REST_CORE_THREAD_CNT` Default size of REST thread pool.
`static int` `DFLT_REST_MAX_THREAD_CNT` Default max size of REST thread pool.
`static int` `DFLT_SOCK_BUF_SIZE` Default socket send and receive buffer size.
`static boolean` `DFLT_TCP_DIRECT_BUF` Default TCP direct buffer flag.
`static boolean` `DFLT_TCP_NODELAY` Default TCP_NODELAY flag.
`static int` `DFLT_TCP_PORT` Default TCP server port.
`static int` `DFLT_THREADPOOL_QUEUE_CAP` Default max queue capacity of REST thread pool.

### Constructor Summary

Constructors
Constructor and Description
`ConnectorConfiguration()` Creates client connection configuration with all default values.
`ConnectorConfiguration(ConnectorConfiguration cfg)` Creates client connection configuration by copying all properties from given configuration.

### Method Summary

Methods
`String` `getHost()` Gets host for TCP binary protocol server.
`long` `getIdleQueryCursorCheckFrequency()` Gets idle query cursors check frequency.
`long` `getIdleQueryCursorTimeout()` Gets idle query cursors timeout in milliseconds.
`long` `getIdleTimeout()` Gets idle timeout for REST server.
`String` `getJettyPath()` Gets path, either absolute or relative to `IGNITE_HOME`, to `Jetty` XML configuration file.
`ConnectorMessageInterceptor` `getMessageInterceptor()` Gets interceptor for objects, moving to and from remote clients.
`int` `getPort()` Gets port for TCP binary protocol server.
`int` `getPortRange()` Gets number of ports to try if configured port is already in use.
`int` `getReceiveBufferSize()` Gets REST TCP server receive buffer size.
`String` `getSecretKey()` Gets secret key to authenticate REST requests.
`int` `getSelectorCount()` Gets number of selector threads in REST TCP server.
`int` `getSendBufferSize()` Gets REST TCP server send buffer size.
`int` `getSendQueueLimit()` Gets REST TCP server send queue limit.
`GridSslContextFactory` `getSslContextFactory()` Deprecated. Use `getSslFactory()` instead.
`javax.cache.configuration.Factory<SSLContext>` `getSslFactory()` Gets context factory that will be used for creating a secure socket layer of rest binary server.
`int` `getThreadPoolSize()` Should return a thread pool size to be used for processing of client messages (REST requests).
`boolean` `isDirectBuffer()` Gets flag indicating whether REST TCP server should use direct buffers.
`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.
`boolean` `isSslEnabled()` Whether secure socket layer should be enabled on binary rest server.
`void` `setDirectBuffer(boolean directBuf)` Sets whether to use direct buffer for REST TCP server.
`void` `setHost(String host)` Sets host for TCP binary protocol server.
`void` `setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq)` Sets idle query cursor check frequency.
`void` `setIdleQueryCursorTimeout(long idleQryCurTimeout)` Sets idle query cursors timeout.
`void` `setIdleTimeout(long idleTimeout)` Sets idle timeout for REST server.
`void` `setJettyPath(String jettyPath)` Sets path, either absolute or relative to `IGNITE_HOME`, to `JETTY` XML configuration file.
`void` `setMessageInterceptor(ConnectorMessageInterceptor interceptor)` Sets client message interceptor.
`void` `setNoDelay(boolean noDelay)` Sets whether `TCP_NODELAY` option should be set for all accepted client connections.
`void` `setPort(int port)` Sets port for TCP binary protocol server.
`void` `setPortRange(int portRange)` Sets number of ports to try if configured one is in use.
`void` `setReceiveBufferSize(int rcvBufSize)` Sets REST TCP server receive buffer size.
`void` `setSecretKey(String secretKey)` Sets secret key to authenticate REST requests.
`void` `setSelectorCount(int selectorCnt)` Sets number of selector threads for REST TCP server.
`void` `setSendBufferSize(int sndBufSize)` Sets REST TCP server send buffer size.
`void` `setSendQueueLimit(int sndQueueLimit)` Sets REST TCP server send queue limit.
`void` `setSslClientAuth(boolean sslClientAuth)` Sets flag indicating whether or not SSL client authentication is required.
`void` `setSslContextFactory(GridSslContextFactory sslCtxFactory)` Deprecated. Use `setSslFactory(Factory)` instead.
`void` `setSslEnabled(boolean sslEnabled)` Sets whether Secure Socket Layer should be enabled for REST TCP binary protocol.
`void` `setSslFactory(javax.cache.configuration.Factory<SSLContext> sslFactory)` Sets instance of `Factory` that will be used to create an instance of `SSLContext` for Secure Socket Layer on TCP binary protocol.
`void` `setThreadPoolSize(int threadPoolSize)` Sets thread pool size to use for processing of client messages (REST requests).

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

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

### Field Detail

#### DFLT_TCP_PORT

    public static final int DFLT_TCP_PORT

Default TCP server port.

See Also:
  Constant Field Values

#### DFLT_TCP_NODELAY

    public static final boolean DFLT_TCP_NODELAY

Default TCP_NODELAY flag.

See Also:
  Constant Field Values

#### DFLT_TCP_DIRECT_BUF

    public static final boolean DFLT_TCP_DIRECT_BUF

Default TCP direct buffer flag.

See Also:
  Constant Field Values

#### DFLT_IDLE_TIMEOUT

    public static final int DFLT_IDLE_TIMEOUT

Default REST idle timeout.

See Also:
  Constant Field Values

#### DFLT_PORT_RANGE

    public static final int DFLT_PORT_RANGE

Default rest port range.

See Also:
  Constant Field Values

#### DFLT_REST_CORE_THREAD_CNT

    public static final int DFLT_REST_CORE_THREAD_CNT

Default size of REST thread pool.

#### DFLT_REST_MAX_THREAD_CNT

    public static final int DFLT_REST_MAX_THREAD_CNT

Default max size of REST thread pool.

#### DFLT_KEEP_ALIVE_TIME

    public static final long DFLT_KEEP_ALIVE_TIME

Default keep alive time for REST thread pool.

See Also:
  Constant Field Values

#### DFLT_THREADPOOL_QUEUE_CAP

    public static final int DFLT_THREADPOOL_QUEUE_CAP

Default max queue capacity of REST thread pool.

See Also:
  Constant Field Values

#### DFLT_SOCK_BUF_SIZE

    public static final int DFLT_SOCK_BUF_SIZE

Default socket send and receive buffer size.

See Also:
  Constant Field Values

### Constructor Detail

#### ConnectorConfiguration

    public ConnectorConfiguration()

Creates client connection configuration with all default values.

#### ConnectorConfiguration

    public ConnectorConfiguration(ConnectorConfiguration cfg)

Creates client connection configuration by copying all properties from given configuration.

Parameters:
  `cfg` - Client configuration.

### Method Detail

#### setJettyPath

    public void setJettyPath(String jettyPath)

Sets path, either absolute or relative to `IGNITE_HOME`, to `JETTY` XML configuration file. `JETTY` is used to support REST over HTTP protocol for accessing Ignite APIs remotely.

Parameters:
  `jettyPath` - Path to `JETTY` XML configuration file.

#### getJettyPath

    public String getJettyPath()

Gets path, either absolute or relative to `IGNITE_HOME`, to `Jetty` XML configuration file. `Jetty` is used to support REST over HTTP protocol for accessing Ignite APIs remotely.

If not provided, Jetty instance with default configuration will be started picking `IgniteSystemProperties.IGNITE_JETTY_HOST` and `IgniteSystemProperties.IGNITE_JETTY_PORT` as host and port respectively.

Returns:
  Path to `JETTY` XML configuration file.
See Also:
  `IgniteSystemProperties.IGNITE_JETTY_HOST`, `IgniteSystemProperties.IGNITE_JETTY_PORT`

#### setSecretKey

    public void setSecretKey(@Nullable
                    String secretKey)

Sets secret key to authenticate REST requests. If key is `null` or empty authentication is disabled.

Parameters:
  `secretKey` - REST secret key.

#### getSecretKey

    @Nullable
    public String getSecretKey()

Gets secret key to authenticate REST requests. If key is `null` or empty authentication is disabled.

Returns:
  Secret key.
See Also:
  `IgniteSystemProperties.IGNITE_JETTY_HOST`, `IgniteSystemProperties.IGNITE_JETTY_PORT`

#### getHost

    public String getHost()

Gets host for TCP binary protocol server. This can be either an IP address or a domain name.

If not defined, system-wide local address will be used (see `IgniteConfiguration.getLocalHost()`.

You can also use `0.0.0.0` value to bind to all locally-available IP addresses.

Returns:
  TCP host.

#### setHost

    public void setHost(String host)

Sets host for TCP binary protocol server.

Parameters:
  `host` - TCP host.

#### getPort

    public int getPort()

Gets port for TCP binary protocol server.

Default is `DFLT_TCP_PORT`.

Returns:
  TCP port.

#### setPort

    public void setPort(int port)

Sets port for TCP binary protocol server.

Parameters:
  `port` - 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 `DFLT_TCP_NODELAY`.

Returns:
  Whether `TCP_NODELAY` option should be enabled.

#### setNoDelay

    public void setNoDelay(boolean noDelay)

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

Parameters:
  `noDelay` - `True` if option should be enabled.
See Also:
  `isNoDelay()`

#### isDirectBuffer

    public boolean isDirectBuffer()

Gets flag indicating whether REST TCP server should use direct buffers. A direct buffer is a buffer that is allocated and accessed using native system calls, without using JVM heap. Enabling direct buffer may improve performance and avoid memory issues (long GC pauses due to huge buffer size).

Returns:
  Whether direct buffer should be used.

#### setDirectBuffer

    public void setDirectBuffer(boolean directBuf)

Sets whether to use direct buffer for REST TCP server.

Parameters:
  `directBuf` - `True` if option should be enabled.
See Also:
  `isDirectBuffer()`

#### getSendBufferSize

    public int getSendBufferSize()

Gets REST TCP server send buffer size.

Returns:
  REST TCP server send buffer size (0 for default).

#### setSendBufferSize

    public void setSendBufferSize(int sndBufSize)

Sets REST TCP server send buffer size.

Parameters:
  `sndBufSize` - Send buffer size.
See Also:
  `getSendBufferSize()`

#### getReceiveBufferSize

    public int getReceiveBufferSize()

Gets REST TCP server receive buffer size.

Returns:
  REST TCP server receive buffer size (0 for default).

#### setReceiveBufferSize

    public void setReceiveBufferSize(int rcvBufSize)

Sets REST TCP server receive buffer size.

Parameters:
  `rcvBufSize` - Receive buffer size.
See Also:
  `getReceiveBufferSize()`

#### getSendQueueLimit

    public int getSendQueueLimit()

Gets REST TCP server send queue limit. If the limit exceeds, all successive writes will block until the queue has enough capacity.

Returns:
  REST TCP server send queue limit (0 for unlimited).

#### setSendQueueLimit

    public void setSendQueueLimit(int sndQueueLimit)

Sets REST TCP server send queue limit.

Parameters:
  `sndQueueLimit` - REST TCP server send queue limit (0 for unlimited).
See Also:
  `getSendQueueLimit()`

#### getSelectorCount

    public int getSelectorCount()

Gets number of selector threads in REST TCP server. Higher value for this parameter may increase throughput, but also increases context switching.

Returns:
  Number of selector threads for REST TCP server.

#### setSelectorCount

    public void setSelectorCount(int selectorCnt)

Sets number of selector threads for REST TCP server.

Parameters:
  `selectorCnt` - Number of selector threads for REST TCP server.
See Also:
  `getSelectorCount()`

#### getIdleTimeout

    public long getIdleTimeout()

Gets idle timeout for REST server.

This setting is used to reject half-opened sockets. If no packets come within idle timeout, the connection is closed.

Returns:
  Idle timeout in milliseconds.

#### setIdleTimeout

    public void setIdleTimeout(long idleTimeout)

Sets idle timeout for REST server.

Parameters:
  `idleTimeout` - Idle timeout in milliseconds.
See Also:
  `getIdleTimeout()`

#### isSslEnabled

    public boolean isSslEnabled()

Whether secure socket layer should be enabled on binary rest server.

Note that if this flag is set to `true`, an instance of `GridSslContextFactory` should be provided, otherwise binary rest protocol will fail to start.

Returns:
  `True` if SSL should be enabled.

#### setSslEnabled

    public void setSslEnabled(boolean sslEnabled)

Sets whether Secure Socket Layer should be enabled for REST TCP binary protocol.

Note that if this flag is set to `true`, then a valid instance of `GridSslContextFactory` should be provided in `IgniteConfiguration`. Otherwise, TCP binary protocol will fail to start.

Parameters:
  `sslEnabled` - `True` if SSL should be enabled.

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

#### setSslClientAuth

    public void setSslClientAuth(boolean sslClientAuth)

Sets flag indicating whether or not SSL client authentication is required.

Parameters:
  `sslClientAuth` - Whether or not client authentication is required.

#### getSslContextFactory

    @Deprecated
    public GridSslContextFactory getSslContextFactory()

Deprecated. Use `getSslFactory()` instead.
Gets context factory that will be used for creating a secure socket layer of rest binary server.

Returns:
  SslContextFactory instance.
See Also:
  `GridSslContextFactory`

#### setSslContextFactory

    @Deprecated
    public void setSslContextFactory(GridSslContextFactory sslCtxFactory)

Deprecated. Use `setSslFactory(Factory)` instead.
Sets instance of `GridSslContextFactory` that will be used to create an instance of `SSLContext` for Secure Socket Layer on TCP binary protocol. This factory will only be used if `setSslEnabled(boolean)` is set to `true`.

Parameters:
  `sslCtxFactory` - Instance of `GridSslContextFactory`

#### getSslFactory

    public javax.cache.configuration.Factory<SSLContext> getSslFactory()

Gets context factory that will be used for creating a secure socket layer of rest binary server.

Returns:
  SSL context factory instance.
See Also:
  `SslContextFactory`

#### setSslFactory

    public void setSslFactory(javax.cache.configuration.Factory<SSLContext> sslFactory)

Sets instance of `Factory` that will be used to create an instance of `SSLContext` for Secure Socket Layer on TCP binary protocol. This factory will only be used if `setSslEnabled(boolean)` is set to `true`.

Parameters:
  `sslFactory` - Instance of `Factory`

#### getPortRange

    public int getPortRange()

Gets number of ports to try if configured port is already in use. If port range value is `0`, then implementation will try bind only to the port provided by `setPort(int)` method and fail if binding to this port did not succeed.

Returns:
  Number of ports to try.

#### setPortRange

    public void setPortRange(int portRange)

Sets number of ports to try if configured one is in use.

Parameters:
  `portRange` - Port range.

#### getThreadPoolSize

    public int getThreadPoolSize()

Should return a thread pool size to be used for processing of client messages (REST requests).

Returns:
  Thread pool size to be used for processing of client messages.

#### setThreadPoolSize

    public void setThreadPoolSize(int threadPoolSize)

Sets thread pool size to use for processing of client messages (REST requests).

Parameters:
  `threadPoolSize` - Thread pool size to use for processing of client messages.
See Also:
  `getThreadPoolSize()`

#### getMessageInterceptor

    @Nullable
    public ConnectorMessageInterceptor getMessageInterceptor()

Gets interceptor for objects, moving to and from remote clients. If this method returns `null` then no interception will be applied.

Setting interceptor allows to transform all objects exchanged via REST protocol. For example if you use custom serialisation on client you can write interceptor to transform binary representations received from client to Java objects and later access them from java code directly.

Default value is `null`.

Returns:
  Interceptor.
See Also:
  `ConnectorMessageInterceptor`

#### setMessageInterceptor

    public void setMessageInterceptor(ConnectorMessageInterceptor interceptor)

Sets client message interceptor.

Setting interceptor allows to transform all objects exchanged via REST protocol. For example if you use custom serialisation on client you can write interceptor to transform binary representations received from client to Java objects and later access them from java code directly.

Parameters:
  `interceptor` - Interceptor.

#### setIdleQueryCursorTimeout

    public void setIdleQueryCursorTimeout(long idleQryCurTimeout)

Sets idle query cursors timeout.

Parameters:
  `idleQryCurTimeout` - Idle query cursors timeout in milliseconds.
See Also:
  `getIdleQueryCursorTimeout()`

#### getIdleQueryCursorTimeout

    public long getIdleQueryCursorTimeout()

Gets idle query cursors timeout in milliseconds.

This setting is used to reject open query cursors that is not used. If no fetch query request come within idle timeout, it will be removed on next check for old query cursors (see `getIdleQueryCursorCheckFrequency()`).

Returns:
  Idle query cursors timeout in milliseconds

#### setIdleQueryCursorCheckFrequency

    public void setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq)

Sets idle query cursor check frequency.

Parameters:
  `idleQryCurCheckFreq` - Idle query check frequency in milliseconds.
See Also:
  `getIdleQueryCursorCheckFrequency()`

#### getIdleQueryCursorCheckFrequency

    public long getIdleQueryCursorCheckFrequency()

Gets idle query cursors check frequency. This setting is used to reject open query cursors that is not used.

Scheduler tries with specified period to close queries' cursors that are overtime.

Returns:
  Idle query cursor check frequency in milliseconds.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.9.0
Release Date | : March 2 2017