public class ConnectorConfiguration extends Object
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 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.
|
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.
|
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 |
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() |
public static final int DFLT_TCP_PORT
public static final boolean DFLT_TCP_NODELAY
public static final boolean DFLT_TCP_DIRECT_BUF
public static final int DFLT_IDLE_TIMEOUT
public static final int DFLT_PORT_RANGE
public static final int DFLT_REST_CORE_THREAD_CNT
public static final int DFLT_REST_MAX_THREAD_CNT
public static final long DFLT_KEEP_ALIVE_TIME
public static final int DFLT_THREADPOOL_QUEUE_CAP
public static final int DFLT_SOCK_BUF_SIZE
public ConnectorConfiguration()
public ConnectorConfiguration(ConnectorConfiguration cfg)
cfg
- Client configuration.public ConnectorConfiguration setJettyPath(String jettyPath)
IGNITE_HOME
, to JETTY
XML configuration file. JETTY
is used to support REST over HTTP protocol for
accessing Ignite APIs remotely.jettyPath
- Path to JETTY
XML configuration file.this
for chaining.public String getJettyPath()
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.
JETTY
XML configuration file.IgniteSystemProperties.IGNITE_JETTY_HOST
,
IgniteSystemProperties.IGNITE_JETTY_PORT
public ConnectorConfiguration setSecretKey(@Nullable @Nullable String secretKey)
null
or empty authentication is disabled.secretKey
- REST secret key.this
for chaining.@Nullable public @Nullable String getSecretKey()
null
or empty authentication is disabled.IgniteSystemProperties.IGNITE_JETTY_HOST
,
IgniteSystemProperties.IGNITE_JETTY_PORT
public String getHost()
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.
public ConnectorConfiguration setHost(String host)
host
- TCP host.this
for chaining.public int getPort()
Default is DFLT_TCP_PORT
.
public ConnectorConfiguration setPort(int port)
port
- TCP port.this
for chaining.public boolean isNoDelay()
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
.TCP_NODELAY
option should be enabled.public ConnectorConfiguration setNoDelay(boolean noDelay)
TCP_NODELAY
option should be set for all accepted client connections.noDelay
- True
if option should be enabled.this
for chaining.isNoDelay()
public boolean isDirectBuffer()
public ConnectorConfiguration setDirectBuffer(boolean directBuf)
directBuf
- True
if option should be enabled.this
for chaining.isDirectBuffer()
public int getSendBufferSize()
public ConnectorConfiguration setSendBufferSize(int sndBufSize)
sndBufSize
- Send buffer size.this
for chaining.getSendBufferSize()
public int getReceiveBufferSize()
public ConnectorConfiguration setReceiveBufferSize(int rcvBufSize)
rcvBufSize
- Receive buffer size in bytes.this
for chaining.getReceiveBufferSize()
public int getSendQueueLimit()
public ConnectorConfiguration setSendQueueLimit(int sndQueueLimit)
sndQueueLimit
- REST TCP server send queue limit (0 for unlimited).this
for chaining.getSendQueueLimit()
public int getSelectorCount()
public ConnectorConfiguration setSelectorCount(int selectorCnt)
selectorCnt
- Number of selector threads for REST TCP server.this
for chaining.getSelectorCount()
public long getIdleTimeout()
This setting is used to reject half-opened sockets. If no packets come within idle timeout, the connection is closed.
public ConnectorConfiguration setIdleTimeout(long idleTimeout)
idleTimeout
- Idle timeout in milliseconds.this
for chaining.getIdleTimeout()
public boolean isSslEnabled()
Note that if this flag is set to true
, an instance of the ssl factory
should be provided, otherwise binary rest protocol will fail to start.
True
if SSL should be enabled.public ConnectorConfiguration setSslEnabled(boolean sslEnabled)
true
, then a valid instance of the ssl factory
should be provided in IgniteConfiguration
. Otherwise, TCP binary protocol will fail to start.sslEnabled
- True
if SSL should be enabled.this
for chaining.public boolean isSslClientAuth()
public ConnectorConfiguration setSslClientAuth(boolean sslClientAuth)
sslClientAuth
- Whether or not client authentication is required.this
for chaining.public javax.cache.configuration.Factory<SSLContext> getSslFactory()
SslContextFactory
public ConnectorConfiguration setSslFactory(javax.cache.configuration.Factory<SSLContext> sslFactory)
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
.sslFactory
- Instance of Factory
this
for chaining.public int getPortRange()
setPort(int)
method and fail if binding to this port did not succeed.public ConnectorConfiguration setPortRange(int portRange)
portRange
- Port range.this
for chaining.public int getThreadPoolSize()
public ConnectorConfiguration setThreadPoolSize(int threadPoolSize)
threadPoolSize
- Thread pool size to use for processing of client messages.this
for chaining.getThreadPoolSize()
@Nullable public @Nullable ConnectorMessageInterceptor getMessageInterceptor()
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
.
ConnectorMessageInterceptor
public ConnectorConfiguration setMessageInterceptor(ConnectorMessageInterceptor 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.
interceptor
- Interceptor.this
for chaining.public ConnectorConfiguration setIdleQueryCursorTimeout(long idleQryCurTimeout)
idleQryCurTimeout
- Idle query cursors timeout in milliseconds.this
for chaining.getIdleQueryCursorTimeout()
public long getIdleQueryCursorTimeout()
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()
).
public ConnectorConfiguration setIdleQueryCursorCheckFrequency(long idleQryCurCheckFreq)
idleQryCurCheckFreq
- Idle query check frequency in milliseconds.this
for chaining.getIdleQueryCursorCheckFrequency()
public long getIdleQueryCursorCheckFrequency()
Scheduler tries with specified period to close queries' cursors that are overtime.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023