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 |
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.
|
org.apache.ignite.internal.client.ssl.GridSslContextFactory |
getSslContextFactory()
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 |
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(org.apache.ignite.internal.client.ssl.GridSslContextFactory sslCtxFactory)
Sets instance of
GridSslContextFactory that will be used to create an instance of SSLContext
for Secure Socket Layer on TCP binary protocol. |
void |
setSslEnabled(boolean sslEnabled)
Sets whether Secure Socket Layer should be enabled for REST TCP binary protocol.
|
void |
setThreadPoolSize(int threadPoolSize)
Sets thread pool size to use for processing of client messages (REST requests).
|
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 void 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.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 void setSecretKey(@Nullable String secretKey)
null
or empty authentication is disabled.secretKey
- REST secret key.@Nullable public 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 void setHost(String host)
host
- TCP host.public int getPort()
Default is DFLT_TCP_PORT
.
public void setPort(int port)
port
- TCP port.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 void setNoDelay(boolean noDelay)
TCP_NODELAY
option should be set for all accepted client connections.noDelay
- True
if option should be enabled.isNoDelay()
public boolean isDirectBuffer()
public void setDirectBuffer(boolean directBuf)
directBuf
- True
if option should be enabled.isDirectBuffer()
public int getSendBufferSize()
public void setSendBufferSize(int sndBufSize)
sndBufSize
- Send buffer size.getSendBufferSize()
public int getReceiveBufferSize()
public void setReceiveBufferSize(int rcvBufSize)
rcvBufSize
- Receive buffer size.getReceiveBufferSize()
public int getSendQueueLimit()
public void setSendQueueLimit(int sndQueueLimit)
sndQueueLimit
- REST TCP server send queue limit (0 for unlimited).getSendQueueLimit()
public int getSelectorCount()
public void setSelectorCount(int selectorCnt)
selectorCnt
- Number of selector threads for REST TCP server.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 void setIdleTimeout(long idleTimeout)
idleTimeout
- Idle timeout in milliseconds.getIdleTimeout()
public boolean isSslEnabled()
Note that if this flag is set to true
, an instance of GridSslContextFactory
should be provided, otherwise binary rest protocol will fail to start.
True
if SSL should be enabled.public void setSslEnabled(boolean sslEnabled)
true
, then a valid instance of GridSslContextFactory
should be provided in IgniteConfiguration
. Otherwise, TCP binary protocol will fail to start.sslEnabled
- True
if SSL should be enabled.public boolean isSslClientAuth()
public void setSslClientAuth(boolean sslClientAuth)
sslClientAuth
- Whether or not client authentication is required.public org.apache.ignite.internal.client.ssl.GridSslContextFactory getSslContextFactory()
GridSslContextFactory
public void setSslContextFactory(org.apache.ignite.internal.client.ssl.GridSslContextFactory sslCtxFactory)
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
.sslCtxFactory
- Instance of GridSslContextFactory
public int getPortRange()
public void setPortRange(int portRange)
portRange
- Port range.public int getThreadPoolSize()
public void setThreadPoolSize(int threadPoolSize)
threadPoolSize
- Thread pool size to use for processing of client messages.getThreadPoolSize()
@Nullable public 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 void 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.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015