Class IgniteClient.Builder
- Enclosing interface:
- IgniteClient
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the addresses of Ignite server nodes within a cluster.addressFinder
(IgniteClientAddressFinder addressFinder) Sets the address finder.asyncContinuationExecutor
(Executor asyncContinuationExecutor) Sets the async continuation executor.authenticator
(@Nullable IgniteClientAuthenticator authenticator) Sets the authenticator.backgroundReconnectInterval
(long backgroundReconnectInterval) Sets the background reconnect interval, in milliseconds.build()
Builds the client.Builds the client.cache
(@Nullable ClientCacheConfiguration cacheConfiguration) Sets the cache configuration.connectTimeout
(long connectTimeout) Sets the socket connection timeout, in milliseconds.heartbeatInterval
(long heartbeatInterval) Sets the heartbeat message interval, in milliseconds.heartbeatTimeout
(long heartbeatTimeout) Sets the heartbeat message timeout, in milliseconds.loggerFactory
(@Nullable LoggerFactory loggerFactory) Sets the logger factory.metricsEnabled
(boolean metricsEnabled) Enables or disables JMX metrics.operationTimeout
(long operationTimeout) Sets the operation timeout, in milliseconds.retryPolicy
(@Nullable RetryPolicy retryPolicy) Sets the retry policy.ssl
(@Nullable SslConfiguration sslConfiguration) Sets the SSL configuration.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addresses
Sets the addresses of Ignite server nodes within a cluster. An address can be an IP address or a hostname, with or without port. If port is not set then Ignite will use the default one - seeIgniteClientConfiguration.DFLT_PORT
.- Parameters:
addrs
- Addresses.- Returns:
- This instance.
-
retryPolicy
Sets the retry policy. When a request fails due to a connection error, and multiple server connections are available, Ignite will retry the request if the specified policy allows it.Default is
RetryReadPolicy
.- Parameters:
retryPolicy
- Retry policy.- Returns:
- This instance.
-
loggerFactory
Sets the logger factory. This factory will be used to create a logger instance when needed.When
null
(default),System.getLogger(java.lang.String)
is used.- Parameters:
loggerFactory
- A factory.- Returns:
- This instance.
-
connectTimeout
Sets the socket connection timeout, in milliseconds.Default is
IgniteClientConfiguration.DFLT_CONNECT_TIMEOUT
.- Parameters:
connectTimeout
- Socket connection timeout, in milliseconds.- Returns:
- This instance.
- Throws:
IllegalArgumentException
- When value is less than zero.
-
addressFinder
Sets the address finder.- Parameters:
addressFinder
- Address finder.- Returns:
- This instance.
-
backgroundReconnectInterval
Sets the background reconnect interval, in milliseconds. Set to0
to disable background reconnect.Ignite balances requests across all healthy connections (when multiple endpoints are configured). Ignite also repairs connections on demand (when a request is made). However, "secondary" connections can be lost (due to network issues, or node restarts). This property controls how ofter Ignite client will check all configured endpoints and try to reconnect them in case of failure.
- Parameters:
backgroundReconnectInterval
- Reconnect interval, in milliseconds.- Returns:
- This instance.
- Throws:
IllegalArgumentException
- When value is less than zero.
-
asyncContinuationExecutor
Sets the async continuation executor.When
null
(default),ForkJoinPool.commonPool()
is used.When async client operation completes, corresponding
CompletableFuture
continuations (such asCompletableFuture.thenApply(Function)
) will be invoked using this executor.Server responses are handled by a dedicated network thread. To ensure optimal performance, this thread should not perform any extra work, so user-defined continuations are offloaded to the specified executor.
- Parameters:
asyncContinuationExecutor
- Async continuation executor.- Returns:
- This instance.
-
heartbeatInterval
Sets the heartbeat message interval, in milliseconds. Default is30_000
.When server-side idle timeout is not zero, effective heartbeat interval is set to
min(heartbeatInterval, idleTimeout / 3)
.When thin client connection is idle (no operations are performed), heartbeat messages are sent periodically to keep the connection alive and detect potential half-open state.
- Parameters:
heartbeatInterval
- Heartbeat interval.- Returns:
- This instance.
-
heartbeatTimeout
Sets the heartbeat message timeout, in milliseconds. Default is5000
.When a server does not respond to a heartbeat within the specified timeout, client will close the connection.
- Parameters:
heartbeatTimeout
- Heartbeat timeout.- Returns:
- This instance.
-
ssl
Sets the SSL configuration.- Parameters:
sslConfiguration
- SSL configuration.- Returns:
- This instance.
-
metricsEnabled
Enables or disables JMX metrics.When enabled, Ignite client will expose JMX metrics via the platform MBean server with bean name "org.apache.ignite:group=metrics,name=client".
Use
jconsole
or any other JMX client to view the metrics.To get metrics programmatically:
MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), new ObjectName("org.apache.ignite:group=metrics,name=client"), DynamicMBean.class, false).getAttribute("ConnectionsActive")
See Java Management Extensions (JMX) for more information.
- Parameters:
metricsEnabled
- Metrics enabled flag.- Returns:
- This instance.
-
authenticator
public IgniteClient.Builder authenticator(@Nullable @Nullable IgniteClientAuthenticator authenticator) Sets the authenticator.See also:
BasicAuthenticator
.- Parameters:
authenticator
- Authenticator.- Returns:
- This instance.
-
operationTimeout
Sets the operation timeout, in milliseconds. Default is0
(no timeout).An "operation" is a single client request to the server. Some public API calls may involve multiple operations, in which case the operation timeout is applied to each individual network call.
- Parameters:
operationTimeout
- Operation timeout, in milliseconds.- Returns:
- This instance.
- Throws:
IllegalArgumentException
- When value is less than zero.
-
cache
Sets the cache configuration.- Parameters:
cacheConfiguration
- Cache configuration.- Returns:
- This instance.
-
build
Builds the client.- Returns:
- Ignite client.
-
buildAsync
Builds the client.- Returns:
- Ignite client.
-