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
    Modifier and Type | Field and Description
    --- | ---
    `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

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `@Nullable 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 in bytes.
    `@Nullable 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.
    `org.apache.ignite.internal.client.ssl.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.
    `ConnectorConfiguration` | `setDirectBuffer(boolean directBuf)` Sets whether to use direct buffer for REST TCP server.
    `ConnectorConfiguration` | `setHost(String host)` Sets host for TCP binary protocol server.
    `ConnectorConfiguration` | `setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq)` Sets idle query cursor check frequency.
    `ConnectorConfiguration` | `setIdleQueryCursorTimeout(long idleQryCurTimeout)` Sets idle query cursors timeout.
    `ConnectorConfiguration` | `setIdleTimeout(long idleTimeout)` Sets idle timeout for REST server.
    `ConnectorConfiguration` | `setJettyPath(String jettyPath)` Sets path, either absolute or relative to `IGNITE_HOME`, to `JETTY` XML configuration file.
    `ConnectorConfiguration` | `setMessageInterceptor(ConnectorMessageInterceptor interceptor)` Sets client message interceptor.
    `ConnectorConfiguration` | `setNoDelay(boolean noDelay)` Sets whether `TCP_NODELAY` option should be set for all accepted client connections.
    `ConnectorConfiguration` | `setPort(int port)` Sets port for TCP binary protocol server.
    `ConnectorConfiguration` | `setPortRange(int portRange)` Sets number of ports to try if configured one is in use.
    `ConnectorConfiguration` | `setReceiveBufferSize(int rcvBufSize)` Sets REST TCP server receive buffer size in bytes.
    `ConnectorConfiguration` | `setSecretKey(@Nullable String secretKey)` Sets secret key to authenticate REST requests.
    `ConnectorConfiguration` | `setSelectorCount(int selectorCnt)` Sets number of selector threads for REST TCP server.
    `ConnectorConfiguration` | `setSendBufferSize(int sndBufSize)` Sets REST TCP server send buffer size.
    `ConnectorConfiguration` | `setSendQueueLimit(int sndQueueLimit)` Sets REST TCP server send queue limit.
    `ConnectorConfiguration` | `setSslClientAuth(boolean sslClientAuth)` Sets flag indicating whether or not SSL client authentication is required.
    `ConnectorConfiguration` | `setSslContextFactory(org.apache.ignite.internal.client.ssl.GridSslContextFactory sslCtxFactory)` Deprecated. Use `setSslFactory(Factory)` instead.
    `ConnectorConfiguration` | `setSslEnabled(boolean sslEnabled)` Sets whether Secure Socket Layer should be enabled for REST TCP binary protocol.
    `ConnectorConfiguration` | `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.
    `ConnectorConfiguration` | `setThreadPoolSize(int threadPoolSize)` Sets thread pool size to use for processing of client messages (REST requests).
    `String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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 ConnectorConfiguration 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.
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration setSecretKey(@Nullable
                                                     @Nullable String secretKey)

      Sets secret key to authenticate REST requests. If key is `null` or empty authentication is disabled.
      Parameters:
        `secretKey` - REST secret key.
      Returns:
        `this` for chaining.

    - #### getSecretKey

          @Nullable
          public @Nullable 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 ConnectorConfiguration setHost(String host)

      Sets host for TCP binary protocol server.
      Parameters:
        `host` - TCP host.
      Returns:
        `this` for chaining.

    - #### getPort

          public int getPort()

      Gets port for TCP binary protocol server.

      Default is `DFLT_TCP_PORT`.

      Returns:
        TCP port.

    - #### setPort

          public ConnectorConfiguration setPort(int port)

      Sets port for TCP binary protocol server.
      Parameters:
        `port` - TCP port.
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration setNoDelay(boolean noDelay)

      Sets whether `TCP_NODELAY` option should be set for all accepted client connections.
      Parameters:
        `noDelay` - `True` if option should be enabled.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setDirectBuffer(boolean directBuf)

      Sets whether to use direct buffer for REST TCP server.
      Parameters:
        `directBuf` - `True` if option should be enabled.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setSendBufferSize(int sndBufSize)

      Sets REST TCP server send buffer size.
      Parameters:
        `sndBufSize` - Send buffer size.
      Returns:
        `this` for chaining.
      See Also:
        `getSendBufferSize()`

    - #### getReceiveBufferSize

          public int getReceiveBufferSize()

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

    - #### setReceiveBufferSize

          public ConnectorConfiguration setReceiveBufferSize(int rcvBufSize)

      Sets REST TCP server receive buffer size in bytes.
      Parameters:
        `rcvBufSize` - Receive buffer size in bytes.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setSendQueueLimit(int sndQueueLimit)

      Sets REST TCP server send queue limit.
      Parameters:
        `sndQueueLimit` - REST TCP server send queue limit (0 for unlimited).
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setSelectorCount(int selectorCnt)

      Sets number of selector threads for REST TCP server.
      Parameters:
        `selectorCnt` - Number of selector threads for REST TCP server.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setIdleTimeout(long idleTimeout)

      Sets idle timeout for REST server.
      Parameters:
        `idleTimeout` - Idle timeout in milliseconds.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration 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.
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration setSslClientAuth(boolean sslClientAuth)

      Sets flag indicating whether or not SSL client authentication is required.
      Parameters:
        `sslClientAuth` - Whether or not client authentication is required.
      Returns:
        `this` for chaining.

    - #### getSslContextFactory

          @Deprecated
          public org.apache.ignite.internal.client.ssl.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 ConnectorConfiguration setSslContextFactory(org.apache.ignite.internal.client.ssl.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`
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration 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`
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration setPortRange(int portRange)

      Sets number of ports to try if configured one is in use.
      Parameters:
        `portRange` - Port range.
      Returns:
        `this` for chaining.

    - #### 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 ConnectorConfiguration 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.
      Returns:
        `this` for chaining.
      See Also:
        `getThreadPoolSize()`

    - #### getMessageInterceptor

          @Nullable
          public @Nullable 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 ConnectorConfiguration 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.
      Returns:
        `this` for chaining.

    - #### setIdleQueryCursorTimeout

          public ConnectorConfiguration setIdleQueryCursorTimeout(long idleQryCurTimeout)

      Sets idle query cursors timeout.
      Parameters:
        `idleQryCurTimeout` - Idle query cursors timeout in milliseconds.
      Returns:
        `this` for chaining.
      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 ConnectorConfiguration setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq)

      Sets idle query cursor check frequency.
      Parameters:
        `idleQryCurCheckFreq` - Idle query check frequency in milliseconds.
      Returns:
        `this` for chaining.
      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.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021